From ae6b0e0f4990421f15157510a1ed53788bf99bff Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Fri, 19 Oct 2018 14:19:32 +0200 Subject: [PATCH] options: Set the global known_hosts file Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- src/options.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/options.c b/src/options.c index 0e78c85c..576af075 100644 --- a/src/options.c +++ b/src/options.c @@ -1370,6 +1370,17 @@ int ssh_options_apply(ssh_session session) { free(session->opts.knownhosts); session->opts.knownhosts = tmp; + if (session->opts.global_knownhosts == NULL) { + tmp = strdup("/etc/ssh/ssh_known_hosts"); + } else { + tmp = ssh_path_expand_escape(session, session->opts.global_knownhosts); + } + if (tmp == NULL) { + return -1; + } + free(session->opts.global_knownhosts); + session->opts.global_knownhosts = tmp; + if (session->opts.ProxyCommand != NULL) { tmp = ssh_path_expand_escape(session, session->opts.ProxyCommand); if (tmp == NULL) {