diff options
author | 2020-07-17 03:23:10 +0000 | |
---|---|---|
committer | 2020-07-17 03:23:10 +0000 | |
commit | f02ae39d195d711adcb5889f8b272886d791191f (patch) | |
tree | e04bd223e0011ad8b27d96294d010a40b28bf0dc /usr.bin/ssh/ssh.c | |
parent | add kstats to myx. (diff) | |
download | wireguard-openbsd-f02ae39d195d711adcb5889f8b272886d791191f.tar.xz wireguard-openbsd-f02ae39d195d711adcb5889f8b272886d791191f.zip |
Add %-TOKEN, environment variable and tilde expansion to UserKnownHostsFile,
allowing the file to be automagically split up in the configuration
(eg bz#1654). ok djm@, man page parts jmc@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index e7efcc628f0..34def8473d8 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.531 2020/07/05 23:59:45 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.532 2020/07/17 03:23:10 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -638,6 +638,7 @@ main(int ac, char **av) struct Forward fwd; struct addrinfo *addrs = NULL; size_t n, len; + u_int j; /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ sanitise_stdfd(); @@ -1406,6 +1407,21 @@ main(int ac, char **av) options.forward_agent_sock_path = cp; } + for (j = 0; j < options.num_user_hostfiles; j++) { + if (options.user_hostfiles[j] != NULL) { + cp = tilde_expand_filename(options.user_hostfiles[j], + getuid()); + p = default_client_percent_dollar_expand(cp, + pw->pw_dir, host, options.user, pw->pw_name); + if (strcmp(options.user_hostfiles[j], p) != 0) + debug3("expanded UserKnownHostsFile '%s' -> " + "'%s'", options.user_hostfiles[j], p); + free(options.user_hostfiles[j]); + free(cp); + options.user_hostfiles[j] = p; + } + } + for (i = 0; i < options.num_local_forwards; i++) { if (options.local_forwards[i].listen_path != NULL) { cp = options.local_forwards[i].listen_path; |