summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-01-25 07:17:18 +0000
committerDamien Miller <djm@mindrot.org>2020-01-25 18:20:01 +1100
commit022ce92fa0daa9d78830baeb2bd2dc3f83c724ba (patch)
treef2636fb014494e4687ece2418ea7ea5072cf7ac2 /sshconnect.c
parent0b813436bbf6546638b10c1fa71f54691bcf5e63 (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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 690240716..4711af782 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.327 2020/01/23 07:10:22 dtucker Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.328 2020/01/25 07:17:18 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1406,8 +1406,8 @@ ssh_local_cmd(const char *args)
1406} 1406}
1407 1407
1408void 1408void
1409maybe_add_key_to_agent(char *authfile, struct sshkey *private, 1409maybe_add_key_to_agent(const char *authfile, struct sshkey *private,
1410 char *comment, char *passphrase) 1410 const char *comment, const char *passphrase)
1411{ 1411{
1412 int auth_sock = -1, r; 1412 int auth_sock = -1, r;
1413 const char *skprovider = NULL; 1413 const char *skprovider = NULL;
@@ -1428,7 +1428,8 @@ maybe_add_key_to_agent(char *authfile, struct sshkey *private,
1428 } 1428 }
1429 if (sshkey_is_sk(private)) 1429 if (sshkey_is_sk(private))
1430 skprovider = options.sk_provider; 1430 skprovider = options.sk_provider;
1431 if ((r = ssh_add_identity_constrained(auth_sock, private, comment, 0, 1431 if ((r = ssh_add_identity_constrained(auth_sock, private,
1432 comment == NULL ? authfile : comment, 0,
1432 (options.add_keys_to_agent == 3), 0, skprovider)) == 0) 1433 (options.add_keys_to_agent == 3), 0, skprovider)) == 0)
1433 debug("identity added to agent: %s", authfile); 1434 debug("identity added to agent: %s", authfile);
1434 else 1435 else