diff options
author | djm@openbsd.org <djm@openbsd.org> | 2020-01-25 07:17:18 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-01-25 18:20:01 +1100 |
commit | 022ce92fa0daa9d78830baeb2bd2dc3f83c724ba (patch) | |
tree | f2636fb014494e4687ece2418ea7ea5072cf7ac2 /sshconnect.c | |
parent | 0b813436bbf6546638b10c1fa71f54691bcf5e63 (diff) |
upstream: 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
OpenBSD-Commit-ID: 8dd8ca9340d7017631a27f4ed5358a4cfddec16f
Diffstat (limited to 'sshconnect.c')
-rw-r--r-- | sshconnect.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sshconnect.c b/sshconnect.c index 69024071..4711af78 100644 --- a/sshconnect.c +++ b/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 @@ -1406,8 +1406,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; @@ -1428,7 +1428,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 |