aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-06-15 14:40:54 +0000
committerWerner Koch <[email protected]>2022-06-15 14:41:30 +0000
commit2766b9e56c778d3cbed93aeec5821363a4277c52 (patch)
tree14b88ad709ce37abb2b32b68ddc43aa44ecb69cf
parentagent: New option --no-user-trustlist and --sys-trustlist-name. (diff)
downloadgnupg-2766b9e56c778d3cbed93aeec5821363a4277c52.tar.gz
gnupg-2766b9e56c778d3cbed93aeec5821363a4277c52.zip
agent,ssh: Fix for make not-inserted OpenPGP.3 keys available for SSH.
* agent/command-ssh.c (ssh_send_available_keys): Do not bump key_counter for ignored keys. Also use opt.debug instead of opt.verbose and fix a memory leak. -- The error shown by "ssh-add -l" before this fix was: error fetching identities: incomplete messag Fixes-commit: 193fcc2f7a8cca5240ce50499c54f99235a87e1c GnuPG-bug-id: 5996
-rw-r--r--agent/command-ssh.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 8634ec01a..b52604b70 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -2582,7 +2582,7 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *key_counter_p)
xfree (cardsn);
if (err)
{
- if (opt.verbose)
+ if (opt.debug)
gcry_log_debugsxp ("pubkey", key_public);
if (gpg_err_code (err) == GPG_ERR_UNKNOWN_CURVE
|| gpg_err_code (err) == GPG_ERR_INV_CURVE)
@@ -2594,12 +2594,13 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *key_counter_p)
else
{
gcry_sexp_release (key_public);
- break;
+ break; /* the readdir loop. */
}
}
+ else /* Success */
+ (*key_counter_p)++;
gcry_sexp_release (key_public);
- (*key_counter_p)++;
}
gnupg_closedir (dir);
@@ -2616,7 +2617,7 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *key_counter_p)
xfree (cardsn);
if (err)
{
- if (opt.verbose)
+ if (opt.debug)
gcry_log_debugsxp ("pubkey", key_public);
if (gpg_err_code (err) == GPG_ERR_UNKNOWN_CURVE
|| gpg_err_code (err) == GPG_ERR_INV_CURVE)
@@ -2631,8 +2632,10 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *key_counter_p)
break;
}
}
- else
+ else /* Success. */
(*key_counter_p)++;
+
+ gcry_sexp_release (key_public);
}
agent_card_free_keyinfo (keyinfo_on_cards);