Skip to content

Commit

Permalink
require public key for signing only when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
sisp committed Jun 6, 2024
1 parent cc80d51 commit 799729d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ssh-keygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2735,16 +2735,16 @@ sig_sign(const char *keypath, const char *sig_namespace, int require_agent,
if (sig_process_opts(opts, nopts, &hashalg, NULL, NULL) != 0)
goto done; /* error already logged */

if ((r = sshkey_load_public(keypath, &pubkey, NULL)) != 0) {
error_r(r, "Couldn't load public key %s", keypath);
goto done;
}
if ((r = sshkey_load_public(keypath, &pubkey, NULL)) != 0)
debug_r(r, "Couldn't load public key %s", keypath);

if ((r = ssh_get_authentication_socket(&agent_fd)) != 0) {
if (require_agent)
fatal("Couldn't get agent socket");
debug_r(r, "Couldn't get agent socket");
} else {
if (pubkey == NULL)
fatal("Couldn't load public key %s", keypath);
if ((r = ssh_agent_has_key(agent_fd, pubkey)) == 0)
signer = agent_signer;
else {
Expand Down

0 comments on commit 799729d

Please sign in to comment.