View | Details | Raw Unified | Return to bug 3429 | Differences between
and this patch

Collapse All | Expand All

(-)a/ssh-keygen.c (-6 / +11 lines)
Lines 2631-2638 sig_process_opts(char * const *opts, size_t nopts, char **hashalgp, Link Here
2631
2631
2632
2632
2633
static int
2633
static int
2634
sig_sign(const char *keypath, const char *sig_namespace, int argc, char **argv,
2634
sig_sign(const char *keypath, const char *sig_namespace, int require_agent,
2635
    char * const *opts, size_t nopts)
2635
    int argc, char **argv, char * const *opts, size_t nopts)
2636
{
2636
{
2637
	int i, fd = -1, r, ret = -1;
2637
	int i, fd = -1, r, ret = -1;
2638
	int agent_fd = -1;
2638
	int agent_fd = -1;
Lines 2656-2668 sig_sign(const char *keypath, const char *sig_namespace, int argc, char **argv, Link Here
2656
		goto done;
2656
		goto done;
2657
	}
2657
	}
2658
2658
2659
	if ((r = ssh_get_authentication_socket(&agent_fd)) != 0)
2659
	if ((r = ssh_get_authentication_socket(&agent_fd)) != 0) {
2660
		if (require_agent)
2661
			fatal("Couldn't get agent socket");
2660
		debug_r(r, "Couldn't get agent socket");
2662
		debug_r(r, "Couldn't get agent socket");
2661
	else {
2663
	} else {
2662
		if ((r = ssh_agent_has_key(agent_fd, pubkey)) == 0)
2664
		if ((r = ssh_agent_has_key(agent_fd, pubkey)) == 0)
2663
			signer = agent_signer;
2665
			signer = agent_signer;
2664
		else
2666
		else {
2667
			if (require_agent)
2668
				fatal("Couldn't find key in agent");
2665
			debug_r(r, "Couldn't find key in agent");
2669
			debug_r(r, "Couldn't find key in agent");
2670
		}
2666
	}
2671
	}
2667
2672
2668
	if (signer == NULL) {
2673
	if (signer == NULL) {
Lines 3517-3523 main(int argc, char **argv) Link Here
3517
				exit(1);
3522
				exit(1);
3518
			}
3523
			}
3519
			return sig_sign(identity_file, cert_principals,
3524
			return sig_sign(identity_file, cert_principals,
3520
			    argc, argv, opts, nopts);
3525
			    prefer_agent, argc, argv, opts, nopts);
3521
		} else if (strncmp(sign_op, "check-novalidate", 16) == 0) {
3526
		} else if (strncmp(sign_op, "check-novalidate", 16) == 0) {
3522
			/* NB. cert_principals is actually namespace, via -n */
3527
			/* NB. cert_principals is actually namespace, via -n */
3523
			if (cert_principals == NULL ||
3528
			if (cert_principals == NULL ||

Return to bug 3429