1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-18 14:17:03 +01:00

agent: Avoid blanks in the ssh key's comment.

* agent/command-ssh.c (card_key_available): Replace blanks.
--

For managing the authorized_key file of ssh it is convenient if the
comment does not have any spaces.  Thus we now return

  cardno:FFFE_50FF3D01

instead of

  cardno:FFFE 50FF3D01

Note that gpg --export-ssh-key uses the keyid as comment because it
does not known the S/N of the card.  Gpg-agent however does not know
about OpenPGP and uses the s/n.
This commit is contained in:
Werner Koch 2022-11-02 10:40:24 +01:00
parent 2c1aaed621
commit bd612f2360
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -2424,6 +2424,7 @@ card_key_available (ctrl_t ctrl, const struct card_key_info_s *keyinfo,
if (cardsn) if (cardsn)
{ {
char *dispsn; char *dispsn;
char *p;
/* If the card handler is able to return a short serialnumber, /* If the card handler is able to return a short serialnumber,
use that one, else use the complete serialno. */ use that one, else use the complete serialno. */
@ -2442,6 +2443,10 @@ card_key_available (ctrl_t ctrl, const struct card_key_info_s *keyinfo,
gcry_sexp_release (s_pk); gcry_sexp_release (s_pk);
return err; return err;
} }
/* Let's avoid blanks in the comment. */
for (p=*cardsn; *p; p++)
if (spacep (p))
*p = '_';
} }
xfree (pkbuf); xfree (pkbuf);