aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command-ssh.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-01-22 15:12:49 +0000
committerWerner Koch <[email protected]>2025-01-22 15:12:49 +0000
commit2469dc5aae671247100339493ad7919919a02db9 (patch)
treed64d4078f1ba8fd54d299550e94e1ae4577a7df9 /agent/command-ssh.c
parentgpg: Fix handling with no CRC armor. (diff)
downloadgnupg-2469dc5aae671247100339493ad7919919a02db9.tar.gz
gnupg-2469dc5aae671247100339493ad7919919a02db9.zip
agent: Fix ssh-agent's request_identities for skipped keys.
* agent/command-ssh.c (ssh_send_available_keys): Adjust key counter for skipped keys. -- Fixes-commit: 8b8a8b246c443d5631a88ec59b88edf00aa0ff51 which introduced a regression due to an extra variable for counting the keys. The bug showed up for example if a card with a Brainpool Auth key was also used. Unfortunately OpenSSH still does not allow for Brainpool keys.
Diffstat (limited to 'agent/command-ssh.c')
-rw-r--r--agent/command-ssh.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 47c546bdc..8e812a643 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -2585,7 +2585,7 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
struct card_key_info_s *keyinfo_on_cards, *l;
char *cardsn;
gcry_sexp_t key_public = NULL;
- int count;
+ int count, skipped;
struct key_collection_s keyarray = { NULL };
err = open_control_file (&cf, 0);
@@ -2753,6 +2753,7 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
keyarray.items[count].key, keyarray.items[count].cardsn);
/* And print the keys. */
+ skipped = 0;
for (count=0; count < keyarray.nitems; count++)
{
err = ssh_send_key_public (key_blobs, keyarray.items[count].key,
@@ -2767,12 +2768,13 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
/* For example a Brainpool curve or a curve we don't
* support at all but a smartcard lists that curve.
* We ignore them. */
+ skipped++;
}
else
goto leave;
}
}
- *r_key_counter = count;
+ *r_key_counter = count - skipped;
leave:
agent_card_free_keyinfo (keyinfo_on_cards);