summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-01-30 22:19:32 +0000
committerDamien Miller <djm@mindrot.org>2020-01-31 09:27:10 +1100
commitd53a518536c552672c00e8892e2aea28f664148c (patch)
tree12578e537a0bfd598e7ad016bd64d5dcac78e6ae /readconf.c
parentbb63ff844e818d188da4fed3c016e0a4eecbbf25 (diff)
upstream: enable UpdateKnownHosts=yes if the configuration
specifies only the default known_hosts files, otherwise select UpdateKnownHosts=ask; ok markus@ OpenBSD-Commit-ID: ab401a5ec4a33d2e1a9449eae6202e4b6d427df7
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/readconf.c b/readconf.c
index 36312d583..a6a160182 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.323 2020/01/25 00:22:31 djm Exp $ */ 1/* $OpenBSD: readconf.c,v 1.324 2020/01/30 22:19:32 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
@@ -2110,6 +2110,19 @@ fill_default_options(Options * options)
2110 options->system_hostfiles[options->num_system_hostfiles++] = 2110 options->system_hostfiles[options->num_system_hostfiles++] =
2111 xstrdup(_PATH_SSH_SYSTEM_HOSTFILE2); 2111 xstrdup(_PATH_SSH_SYSTEM_HOSTFILE2);
2112 } 2112 }
2113 if (options->update_hostkeys == -1) {
2114 /*
2115 * Enable UpdateHostKeys non-interactively if the user has
2116 * not overridden the default known_hosts selection, or has
2117 * overridden it with the default. Otherwise, prompt.
2118 */
2119 if (options->num_user_hostfiles == 0 ||
2120 (options->num_user_hostfiles == 1 && strcmp(options->
2121 user_hostfiles[0], _PATH_SSH_USER_HOSTFILE) == 0))
2122 options->update_hostkeys = SSH_UPDATE_HOSTKEYS_YES;
2123 else
2124 options->update_hostkeys = SSH_UPDATE_HOSTKEYS_ASK;
2125 }
2113 if (options->num_user_hostfiles == 0) { 2126 if (options->num_user_hostfiles == 0) {
2114 options->user_hostfiles[options->num_user_hostfiles++] = 2127 options->user_hostfiles[options->num_user_hostfiles++] =
2115 xstrdup(_PATH_SSH_USER_HOSTFILE); 2128 xstrdup(_PATH_SSH_USER_HOSTFILE);
@@ -2170,8 +2183,6 @@ fill_default_options(Options * options)
2170 options->canonicalize_hostname = SSH_CANONICALISE_NO; 2183 options->canonicalize_hostname = SSH_CANONICALISE_NO;
2171 if (options->fingerprint_hash == -1) 2184 if (options->fingerprint_hash == -1)
2172 options->fingerprint_hash = SSH_FP_HASH_DEFAULT; 2185 options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
2173 if (options->update_hostkeys == -1)
2174 options->update_hostkeys = SSH_UPDATE_HOSTKEYS_ASK;
2175#ifdef ENABLE_SK_INTERNAL 2186#ifdef ENABLE_SK_INTERNAL
2176 if (options->sk_provider == NULL) 2187 if (options->sk_provider == NULL)
2177 options->sk_provider = xstrdup("internal"); 2188 options->sk_provider = xstrdup("internal");