summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c57
1 files changed, 11 insertions, 46 deletions
diff --git a/readconf.c b/readconf.c
index 975f00ff4..963c648b9 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.272 2017/04/30 23:10:43 djm Exp $ */ 1/* $OpenBSD: readconf.c,v 1.273 2017/04/30 23:11:45 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
@@ -152,7 +152,7 @@ typedef enum {
152 oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, 152 oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts,
153 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression, 153 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression,
154 oCompressionLevel, oTCPKeepAlive, oNumberOfPasswordPrompts, 154 oCompressionLevel, oTCPKeepAlive, oNumberOfPasswordPrompts,
155 oUsePrivilegedPort, oLogFacility, oLogLevel, oCiphers, oProtocol, oMacs, 155 oUsePrivilegedPort, oLogFacility, oLogLevel, oCiphers, oMacs,
156 oPubkeyAuthentication, 156 oPubkeyAuthentication,
157 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias, 157 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias,
158 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication, 158 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication,
@@ -171,7 +171,7 @@ typedef enum {
171 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, 171 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
172 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, 172 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
173 oPubkeyAcceptedKeyTypes, oProxyJump, 173 oPubkeyAcceptedKeyTypes, oProxyJump,
174 oIgnoredUnknownOption, oDeprecated, oUnsupported 174 oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported
175} OpCodes; 175} OpCodes;
176 176
177/* Textual representations of the tokens. */ 177/* Textual representations of the tokens. */
@@ -181,6 +181,7 @@ static struct {
181 OpCodes opcode; 181 OpCodes opcode;
182} keywords[] = { 182} keywords[] = {
183 /* Deprecated options */ 183 /* Deprecated options */
184 { "protocol", oIgnore }, /* NB. silently ignored */
184 { "fallbacktorsh", oDeprecated }, 185 { "fallbacktorsh", oDeprecated },
185 { "globalknownhostsfile2", oDeprecated }, 186 { "globalknownhostsfile2", oDeprecated },
186 { "rhostsauthentication", oDeprecated }, 187 { "rhostsauthentication", oDeprecated },
@@ -242,7 +243,6 @@ static struct {
242 { "cipher", oCipher }, 243 { "cipher", oCipher },
243 { "ciphers", oCiphers }, 244 { "ciphers", oCiphers },
244 { "macs", oMacs }, 245 { "macs", oMacs },
245 { "protocol", oProtocol },
246 { "remoteforward", oRemoteForward }, 246 { "remoteforward", oRemoteForward },
247 { "localforward", oLocalForward }, 247 { "localforward", oLocalForward },
248 { "user", oUser }, 248 { "user", oUser },
@@ -866,6 +866,8 @@ process_config_line_depth(Options *options, struct passwd *pw, const char *host,
866 case oBadOption: 866 case oBadOption:
867 /* don't panic, but count bad options */ 867 /* don't panic, but count bad options */
868 return -1; 868 return -1;
869 case oIgnore:
870 return 0;
869 case oIgnoredUnknownOption: 871 case oIgnoredUnknownOption:
870 debug("%s line %d: Ignored unknown option \"%s\"", 872 debug("%s line %d: Ignored unknown option \"%s\"",
871 filename, linenum, keyword); 873 filename, linenum, keyword);
@@ -1236,19 +1238,6 @@ parse_keytypes:
1236 *charptr = xstrdup(arg); 1238 *charptr = xstrdup(arg);
1237 break; 1239 break;
1238 1240
1239 case oProtocol:
1240 intptr = &options->protocol;
1241 arg = strdelim(&s);
1242 if (!arg || *arg == '\0')
1243 fatal("%.200s line %d: Missing argument.", filename, linenum);
1244 value = proto_spec(arg);
1245 if (value == SSH_PROTO_UNKNOWN)
1246 fatal("%.200s line %d: Bad protocol spec '%s'.",
1247 filename, linenum, arg ? arg : "<NONE>");
1248 if (*activep && *intptr == SSH_PROTO_UNKNOWN)
1249 *intptr = value;
1250 break;
1251
1252 case oLogLevel: 1241 case oLogLevel:
1253 log_level_ptr = &options->log_level; 1242 log_level_ptr = &options->log_level;
1254 arg = strdelim(&s); 1243 arg = strdelim(&s);
@@ -1827,7 +1816,6 @@ initialize_options(Options * options)
1827 options->macs = NULL; 1816 options->macs = NULL;
1828 options->kex_algorithms = NULL; 1817 options->kex_algorithms = NULL;
1829 options->hostkeyalgorithms = NULL; 1818 options->hostkeyalgorithms = NULL;
1830 options->protocol = SSH_PROTO_UNKNOWN;
1831 options->num_identity_files = 0; 1819 options->num_identity_files = 0;
1832 options->num_certificate_files = 0; 1820 options->num_certificate_files = 0;
1833 options->hostname = NULL; 1821 options->hostname = NULL;
@@ -1984,27 +1972,16 @@ fill_default_options(Options * options)
1984 if (options->cipher == -1) 1972 if (options->cipher == -1)
1985 options->cipher = SSH_CIPHER_NOT_SET; 1973 options->cipher = SSH_CIPHER_NOT_SET;
1986 /* options->hostkeyalgorithms, default set in myproposals.h */ 1974 /* options->hostkeyalgorithms, default set in myproposals.h */
1987 if (options->protocol == SSH_PROTO_UNKNOWN)
1988 options->protocol = SSH_PROTO_2;
1989 if (options->add_keys_to_agent == -1) 1975 if (options->add_keys_to_agent == -1)
1990 options->add_keys_to_agent = 0; 1976 options->add_keys_to_agent = 0;
1991 if (options->num_identity_files == 0) { 1977 if (options->num_identity_files == 0) {
1992 if (options->protocol & SSH_PROTO_1) { 1978 add_identity_file(options, "~/", _PATH_SSH_CLIENT_ID_RSA, 0);
1993 add_identity_file(options, "~/", 1979 add_identity_file(options, "~/", _PATH_SSH_CLIENT_ID_DSA, 0);
1994 _PATH_SSH_CLIENT_IDENTITY, 0);
1995 }
1996 if (options->protocol & SSH_PROTO_2) {
1997 add_identity_file(options, "~/",
1998 _PATH_SSH_CLIENT_ID_RSA, 0);
1999 add_identity_file(options, "~/",
2000 _PATH_SSH_CLIENT_ID_DSA, 0);
2001#ifdef OPENSSL_HAS_ECC 1980#ifdef OPENSSL_HAS_ECC
2002 add_identity_file(options, "~/", 1981 add_identity_file(options, "~/", _PATH_SSH_CLIENT_ID_ECDSA, 0);
2003 _PATH_SSH_CLIENT_ID_ECDSA, 0);
2004#endif 1982#endif
2005 add_identity_file(options, "~/", 1983 add_identity_file(options, "~/",
2006 _PATH_SSH_CLIENT_ID_ED25519, 0); 1984 _PATH_SSH_CLIENT_ID_ED25519, 0);
2007 }
2008 } 1985 }
2009 if (options->escape_char == -1) 1986 if (options->escape_char == -1)
2010 options->escape_char = '~'; 1987 options->escape_char = '~';
@@ -2395,17 +2372,6 @@ fmt_intarg(OpCodes code, int val)
2395 return fmt_multistate_int(val, multistate_canonicalizehostname); 2372 return fmt_multistate_int(val, multistate_canonicalizehostname);
2396 case oFingerprintHash: 2373 case oFingerprintHash:
2397 return ssh_digest_alg_name(val); 2374 return ssh_digest_alg_name(val);
2398 case oProtocol:
2399 switch (val) {
2400 case SSH_PROTO_1:
2401 return "1";
2402 case SSH_PROTO_2:
2403 return "2";
2404 case (SSH_PROTO_1|SSH_PROTO_2):
2405 return "2,1";
2406 default:
2407 return "UNKNOWN";
2408 }
2409 default: 2375 default:
2410 switch (val) { 2376 switch (val) {
2411 case 0: 2377 case 0:
@@ -2550,7 +2516,6 @@ dump_client_config(Options *o, const char *host)
2550 dump_cfg_fmtint(oNoHostAuthenticationForLocalhost, o->no_host_authentication_for_localhost); 2516 dump_cfg_fmtint(oNoHostAuthenticationForLocalhost, o->no_host_authentication_for_localhost);
2551 dump_cfg_fmtint(oPasswordAuthentication, o->password_authentication); 2517 dump_cfg_fmtint(oPasswordAuthentication, o->password_authentication);
2552 dump_cfg_fmtint(oPermitLocalCommand, o->permit_local_command); 2518 dump_cfg_fmtint(oPermitLocalCommand, o->permit_local_command);
2553 dump_cfg_fmtint(oProtocol, o->protocol);
2554 dump_cfg_fmtint(oProxyUseFdpass, o->proxy_use_fdpass); 2519 dump_cfg_fmtint(oProxyUseFdpass, o->proxy_use_fdpass);
2555 dump_cfg_fmtint(oPubkeyAuthentication, o->pubkey_authentication); 2520 dump_cfg_fmtint(oPubkeyAuthentication, o->pubkey_authentication);
2556 dump_cfg_fmtint(oRequestTTY, o->request_tty); 2521 dump_cfg_fmtint(oRequestTTY, o->request_tty);