diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2020-07-17 03:43:42 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-07-17 13:52:46 +1000 |
commit | 8df5774a42d2eaffe057bd7f293fc6a4b1aa411c (patch) | |
tree | 16e1028b667e7f3fc41034da48367165e1110741 /sshconnect.c | |
parent | c4f239944a4351810fd317edf408bdcd5c0102d9 (diff) |
upstream: Add a '%k' TOKEN that expands to the effective HostKey of
the destination. This allows, eg, keeping host keys in individual files
using "UserKnownHostsFile ~/.ssh/known_hosts.d/%k". bz#1654, ok djm@, jmc@
(man page bits)
OpenBSD-Commit-ID: 7084d723c9cc987a5c47194219efd099af5beadc
Diffstat (limited to 'sshconnect.c')
-rw-r--r-- | sshconnect.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sshconnect.c b/sshconnect.c index af08be415..f6d8a1bcf 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect.c,v 1.329 2020/03/13 04:01:56 djm Exp $ */ | 1 | /* $OpenBSD: sshconnect.c,v 1.330 2020/07/17 03:43:42 dtucker 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 |
@@ -89,11 +89,14 @@ expand_proxy_command(const char *proxy_command, const char *user, | |||
89 | const char *host, const char *host_arg, int port) | 89 | const char *host, const char *host_arg, int port) |
90 | { | 90 | { |
91 | char *tmp, *ret, strport[NI_MAXSERV]; | 91 | char *tmp, *ret, strport[NI_MAXSERV]; |
92 | const char *keyalias = options.host_key_alias ? | ||
93 | options.host_key_alias : host_arg; | ||
92 | 94 | ||
93 | snprintf(strport, sizeof strport, "%d", port); | 95 | snprintf(strport, sizeof strport, "%d", port); |
94 | xasprintf(&tmp, "exec %s", proxy_command); | 96 | xasprintf(&tmp, "exec %s", proxy_command); |
95 | ret = percent_expand(tmp, | 97 | ret = percent_expand(tmp, |
96 | "h", host, | 98 | "h", host, |
99 | "k", keyalias, | ||
97 | "n", host_arg, | 100 | "n", host_arg, |
98 | "p", strport, | 101 | "p", strport, |
99 | "r", options.user, | 102 | "r", options.user, |