diff options
author | 2020-01-25 00:03:36 +0000 | |
---|---|---|
committer | 2020-01-25 00:03:36 +0000 | |
commit | 44e54ccb31e3bda5c68b2bc2df1c3b4d67797ec2 (patch) | |
tree | 0f950be0912e4b8b69547ba02a3f898f9df352c3 /usr.bin/ssh/ssh.c | |
parent | tweak proctitle to include sshd arguments, as these are frequently (diff) | |
download | wireguard-openbsd-44e54ccb31e3bda5c68b2bc2df1c3b4d67797ec2.tar.xz wireguard-openbsd-44e54ccb31e3bda5c68b2bc2df1c3b4d67797ec2.zip |
expose PKCS#11 key labels/X.509 subjects as comments
Extract the key label or X.509 subject string when PKCS#11 keys
are retrieved from the token and plumb this through to places where
it may be used as a comment.
based on https://github.com/openssh/openssh-portable/pull/138
by Danielle Church
feedback and ok markus@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index ca15feba7e8..334670c79ef 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.513 2020/01/23 10:24:29 dtucker Exp $ */ +/* $OpenBSD: ssh.c,v 1.514 2020/01/25 00:03:36 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -2045,7 +2045,8 @@ load_public_identity_files(struct passwd *pw) struct sshkey *certificates[SSH_MAX_CERTIFICATE_FILES]; int certificate_file_userprovided[SSH_MAX_CERTIFICATE_FILES]; #ifdef ENABLE_PKCS11 - struct sshkey **keys; + struct sshkey **keys = NULL; + char **comments = NULL; int nkeys; #endif /* PKCS11 */ @@ -2064,18 +2065,19 @@ load_public_identity_files(struct passwd *pw) options.num_identity_files < SSH_MAX_IDENTITY_FILES && (pkcs11_init(!options.batch_mode) == 0) && (nkeys = pkcs11_add_provider(options.pkcs11_provider, NULL, - &keys)) > 0) { + &keys, &comments)) > 0) { for (i = 0; i < nkeys; i++) { if (n_ids >= SSH_MAX_IDENTITY_FILES) { sshkey_free(keys[i]); + free(comments[i]); continue; } identity_keys[n_ids] = keys[i]; - identity_files[n_ids] = - xstrdup(options.pkcs11_provider); /* XXX */ + identity_files[n_ids] = comments[i]; /* transferred */ n_ids++; } free(keys); + free(comments); } #endif /* ENABLE_PKCS11 */ for (i = 0; i < options.num_identity_files; i++) { |