summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2018-10-19 21:29:01 +0100
committerColin Watson <cjwatson@debian.org>2018-10-19 21:29:01 +0100
commit3d246f10429fc9a37b98eabef94fe8dc7c61002b (patch)
tree1f35b42b5e5f462d35ba452e4dcfa188ce0543fd /readconf.c
parente6547182a54f0f268ee36e7c99319eeddffbaff2 (diff)
parentaede1c34243a6f7feae2fb2cb686ade5f9be6f3d (diff)
Import openssh_7.9p1.orig.tar.gz
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/readconf.c b/readconf.c
index db5f2d547..433811521 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.297 2018/08/12 20:19:13 djm Exp $ */ 1/* $OpenBSD: readconf.c,v 1.300 2018/10/05 14:26:09 naddy 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
@@ -172,7 +172,7 @@ typedef enum {
172 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs, 172 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs,
173 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, 173 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
174 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, 174 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
175 oPubkeyAcceptedKeyTypes, oProxyJump, 175 oPubkeyAcceptedKeyTypes, oCASignatureAlgorithms, oProxyJump,
176 oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported 176 oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported
177} OpCodes; 177} OpCodes;
178 178
@@ -266,6 +266,7 @@ static struct {
266 { "dynamicforward", oDynamicForward }, 266 { "dynamicforward", oDynamicForward },
267 { "preferredauthentications", oPreferredAuthentications }, 267 { "preferredauthentications", oPreferredAuthentications },
268 { "hostkeyalgorithms", oHostKeyAlgorithms }, 268 { "hostkeyalgorithms", oHostKeyAlgorithms },
269 { "casignaturealgorithms", oCASignatureAlgorithms },
269 { "bindaddress", oBindAddress }, 270 { "bindaddress", oBindAddress },
270 { "bindinterface", oBindInterface }, 271 { "bindinterface", oBindInterface },
271 { "clearallforwardings", oClearAllForwardings }, 272 { "clearallforwardings", oClearAllForwardings },
@@ -1157,7 +1158,20 @@ parse_command:
1157 return 0; 1158 return 0;
1158 1159
1159 case oPort: 1160 case oPort:
1160 intptr = &options->port; 1161 arg = strdelim(&s);
1162 if (!arg || *arg == '\0')
1163 fatal("%.200s line %d: Missing argument.",
1164 filename, linenum);
1165 value = a2port(arg);
1166 if (value <= 0)
1167 fatal("%.200s line %d: Bad port '%s'.",
1168 filename, linenum, arg);
1169 if (*activep && options->port == -1)
1170 options->port = value;
1171 break;
1172
1173 case oConnectionAttempts:
1174 intptr = &options->connection_attempts;
1161parse_int: 1175parse_int:
1162 arg = strdelim(&s); 1176 arg = strdelim(&s);
1163 if ((errstr = atoi_err(arg, &value)) != NULL) 1177 if ((errstr = atoi_err(arg, &value)) != NULL)
@@ -1167,10 +1181,6 @@ parse_int:
1167 *intptr = value; 1181 *intptr = value;
1168 break; 1182 break;
1169 1183
1170 case oConnectionAttempts:
1171 intptr = &options->connection_attempts;
1172 goto parse_int;
1173
1174 case oCiphers: 1184 case oCiphers:
1175 arg = strdelim(&s); 1185 arg = strdelim(&s);
1176 if (!arg || *arg == '\0') 1186 if (!arg || *arg == '\0')
@@ -1221,6 +1231,10 @@ parse_keytypes:
1221 *charptr = xstrdup(arg); 1231 *charptr = xstrdup(arg);
1222 break; 1232 break;
1223 1233
1234 case oCASignatureAlgorithms:
1235 charptr = &options->ca_sign_algorithms;
1236 goto parse_keytypes;
1237
1224 case oLogLevel: 1238 case oLogLevel:
1225 log_level_ptr = &options->log_level; 1239 log_level_ptr = &options->log_level;
1226 arg = strdelim(&s); 1240 arg = strdelim(&s);
@@ -1695,7 +1709,18 @@ parse_keytypes:
1695 1709
1696 case oIdentityAgent: 1710 case oIdentityAgent:
1697 charptr = &options->identity_agent; 1711 charptr = &options->identity_agent;
1698 goto parse_string; 1712 arg = strdelim(&s);
1713 if (!arg || *arg == '\0')
1714 fatal("%.200s line %d: Missing argument.",
1715 filename, linenum);
1716 /* Extra validation if the string represents an env var. */
1717 if (arg[0] == '$' && !valid_env_name(arg + 1)) {
1718 fatal("%.200s line %d: Invalid environment name %s.",
1719 filename, linenum, arg);
1720 }
1721 if (*activep && *charptr == NULL)
1722 *charptr = xstrdup(arg);
1723 break;
1699 1724
1700 case oDeprecated: 1725 case oDeprecated:
1701 debug("%s line %d: Deprecated option \"%s\"", 1726 debug("%s line %d: Deprecated option \"%s\"",
@@ -1836,6 +1861,7 @@ initialize_options(Options * options)
1836 options->macs = NULL; 1861 options->macs = NULL;
1837 options->kex_algorithms = NULL; 1862 options->kex_algorithms = NULL;
1838 options->hostkeyalgorithms = NULL; 1863 options->hostkeyalgorithms = NULL;
1864 options->ca_sign_algorithms = NULL;
1839 options->num_identity_files = 0; 1865 options->num_identity_files = 0;
1840 options->num_certificate_files = 0; 1866 options->num_certificate_files = 0;
1841 options->hostname = NULL; 1867 options->hostname = NULL;
@@ -1924,7 +1950,7 @@ fill_default_options_for_canonicalization(Options *options)
1924void 1950void
1925fill_default_options(Options * options) 1951fill_default_options(Options * options)
1926{ 1952{
1927 char *all_cipher, *all_mac, *all_kex, *all_key; 1953 char *all_cipher, *all_mac, *all_kex, *all_key, *all_sig;
1928 int r; 1954 int r;
1929 1955
1930 if (options->forward_agent == -1) 1956 if (options->forward_agent == -1)
@@ -2077,6 +2103,7 @@ fill_default_options(Options * options)
2077 all_mac = mac_alg_list(','); 2103 all_mac = mac_alg_list(',');
2078 all_kex = kex_alg_list(','); 2104 all_kex = kex_alg_list(',');
2079 all_key = sshkey_alg_list(0, 0, 1, ','); 2105 all_key = sshkey_alg_list(0, 0, 1, ',');
2106 all_sig = sshkey_alg_list(0, 1, 1, ',');
2080#define ASSEMBLE(what, defaults, all) \ 2107#define ASSEMBLE(what, defaults, all) \
2081 do { \ 2108 do { \
2082 if ((r = kex_assemble_names(&options->what, \ 2109 if ((r = kex_assemble_names(&options->what, \
@@ -2088,11 +2115,13 @@ fill_default_options(Options * options)
2088 ASSEMBLE(kex_algorithms, KEX_SERVER_KEX, all_kex); 2115 ASSEMBLE(kex_algorithms, KEX_SERVER_KEX, all_kex);
2089 ASSEMBLE(hostbased_key_types, KEX_DEFAULT_PK_ALG, all_key); 2116 ASSEMBLE(hostbased_key_types, KEX_DEFAULT_PK_ALG, all_key);
2090 ASSEMBLE(pubkey_key_types, KEX_DEFAULT_PK_ALG, all_key); 2117 ASSEMBLE(pubkey_key_types, KEX_DEFAULT_PK_ALG, all_key);
2118 ASSEMBLE(ca_sign_algorithms, SSH_ALLOWED_CA_SIGALGS, all_sig);
2091#undef ASSEMBLE 2119#undef ASSEMBLE
2092 free(all_cipher); 2120 free(all_cipher);
2093 free(all_mac); 2121 free(all_mac);
2094 free(all_kex); 2122 free(all_kex);
2095 free(all_key); 2123 free(all_key);
2124 free(all_sig);
2096 2125
2097#define CLEAR_ON_NONE(v) \ 2126#define CLEAR_ON_NONE(v) \
2098 do { \ 2127 do { \
@@ -2614,6 +2643,7 @@ dump_client_config(Options *o, const char *host)
2614 dump_cfg_string(oIgnoreUnknown, o->ignored_unknown); 2643 dump_cfg_string(oIgnoreUnknown, o->ignored_unknown);
2615 dump_cfg_string(oKbdInteractiveDevices, o->kbd_interactive_devices); 2644 dump_cfg_string(oKbdInteractiveDevices, o->kbd_interactive_devices);
2616 dump_cfg_string(oKexAlgorithms, o->kex_algorithms ? o->kex_algorithms : KEX_CLIENT_KEX); 2645 dump_cfg_string(oKexAlgorithms, o->kex_algorithms ? o->kex_algorithms : KEX_CLIENT_KEX);
2646 dump_cfg_string(oCASignatureAlgorithms, o->ca_sign_algorithms ? o->ca_sign_algorithms : SSH_ALLOWED_CA_SIGALGS);
2617 dump_cfg_string(oLocalCommand, o->local_command); 2647 dump_cfg_string(oLocalCommand, o->local_command);
2618 dump_cfg_string(oRemoteCommand, o->remote_command); 2648 dump_cfg_string(oRemoteCommand, o->remote_command);
2619 dump_cfg_string(oLogLevel, log_level_name(o->log_level)); 2649 dump_cfg_string(oLogLevel, log_level_name(o->log_level));