diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2020-01-25 07:17:19 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2020-01-25 07:17:19 +0000 |
commit | 64a1060912013aaf4357363b5c3037c267ef312f (patch) | |
tree | d4cc8dd0ac9979abb2e1d4dbc35f1021382c0158 | |
parent | 93949593ec37d19f0356df6ca310865c5ac141d0 (diff) |
when AddKeysToAgent=yes is set and the key contains no comment,
add the key to the agent with the key's path as the comment.
bz2564
-rw-r--r-- | usr.bin/ssh/sshconnect.c | 9 | ||||
-rw-r--r-- | usr.bin/ssh/sshconnect.h | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c index 7f855927d14..08a9f4db236 100644 --- a/usr.bin/ssh/sshconnect.c +++ b/usr.bin/ssh/sshconnect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect.c,v 1.327 2020/01/23 07:10:22 dtucker Exp $ */ +/* $OpenBSD: sshconnect.c,v 1.328 2020/01/25 07:17:18 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1368,8 +1368,8 @@ ssh_local_cmd(const char *args) } void -maybe_add_key_to_agent(char *authfile, struct sshkey *private, - char *comment, char *passphrase) +maybe_add_key_to_agent(const char *authfile, struct sshkey *private, + const char *comment, const char *passphrase) { int auth_sock = -1, r; const char *skprovider = NULL; @@ -1390,7 +1390,8 @@ maybe_add_key_to_agent(char *authfile, struct sshkey *private, } if (sshkey_is_sk(private)) skprovider = options.sk_provider; - if ((r = ssh_add_identity_constrained(auth_sock, private, comment, 0, + if ((r = ssh_add_identity_constrained(auth_sock, private, + comment == NULL ? authfile : comment, 0, (options.add_keys_to_agent == 3), 0, skprovider)) == 0) debug("identity added to agent: %s", authfile); else diff --git a/usr.bin/ssh/sshconnect.h b/usr.bin/ssh/sshconnect.h index 2e84b8bc523..7c091e2b1bf 100644 --- a/usr.bin/ssh/sshconnect.h +++ b/usr.bin/ssh/sshconnect.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect.h,v 1.39 2019/09/13 04:27:35 djm Exp $ */ +/* $OpenBSD: sshconnect.h,v 1.40 2020/01/25 07:17:18 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. @@ -53,4 +53,5 @@ void ssh_userauth2(struct ssh *ssh, const char *, const char *, int ssh_local_cmd(const char *); -void maybe_add_key_to_agent(char *, struct sshkey *, char *, char *); +void maybe_add_key_to_agent(const char *, struct sshkey *, + const char *, const char *); |