View | Details | Raw Unified | Return to bug 3122 | Differences between
and this patch

Collapse All | Expand All

(-)a/servconf.c (-41 / +47 lines)
Lines 1304-1310 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1304
		cmdline = 1;
1304
		cmdline = 1;
1305
		activep = &cmdline;
1305
		activep = &cmdline;
1306
	}
1306
	}
1307
	if (*activep && opcode != sMatch && opcode != sInclude)
1307
	if (*activep == 1 && opcode != sMatch && opcode != sInclude)
1308
		debug3("%s:%d setting %s %s", filename, linenum, arg, cp);
1308
		debug3("%s:%d setting %s %s", filename, linenum, arg, cp);
1309
	if (*activep == 0 && !(flags & SSHCFG_MATCH)) {
1309
	if (*activep == 0 && !(flags & SSHCFG_MATCH)) {
1310
		if (connectinfo == NULL) {
1310
		if (connectinfo == NULL) {
Lines 1353-1359 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1353
		if ((value = convtime(arg)) == -1)
1353
		if ((value = convtime(arg)) == -1)
1354
			fatal("%s line %d: invalid time value.",
1354
			fatal("%s line %d: invalid time value.",
1355
			    filename, linenum);
1355
			    filename, linenum);
1356
		if (*activep && *intptr == -1)
1356
		if (*activep == 1 && *intptr == -1)
1357
			*intptr = value;
1357
			*intptr = value;
1358
		break;
1358
		break;
1359
1359
Lines 1415-1421 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1415
		if (value == -1)
1415
		if (value == -1)
1416
			fatal("%s line %d: unsupported option \"%s\".",
1416
			fatal("%s line %d: unsupported option \"%s\".",
1417
			    filename, linenum, arg);
1417
			    filename, linenum, arg);
1418
		if (*activep && *intptr == -1)
1418
		if (*activep == 1 && *intptr == -1)
1419
			*intptr = value;
1419
			*intptr = value;
1420
		break;
1420
		break;
1421
1421
Lines 1424-1430 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1424
		if (!arg || *arg == '\0')
1424
		if (!arg || *arg == '\0')
1425
			fatal("%s line %d: missing file name.",
1425
			fatal("%s line %d: missing file name.",
1426
			    filename, linenum);
1426
			    filename, linenum);
1427
		if (*activep) {
1427
		if (*activep == 1) {
1428
			servconf_add_hostkey(filename, linenum,
1428
			servconf_add_hostkey(filename, linenum,
1429
			    options, arg, 1);
1429
			    options, arg, 1);
1430
		}
1430
		}
Lines 1436-1442 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1436
		if (!arg || *arg == '\0')
1436
		if (!arg || *arg == '\0')
1437
			fatal("%s line %d: missing socket name.",
1437
			fatal("%s line %d: missing socket name.",
1438
			    filename, linenum);
1438
			    filename, linenum);
1439
		if (*activep && *charptr == NULL)
1439
		if (*activep == 1 && *charptr == NULL)
1440
			*charptr = !strcmp(arg, SSH_AUTHSOCKET_ENV_NAME) ?
1440
			*charptr = !strcmp(arg, SSH_AUTHSOCKET_ENV_NAME) ?
1441
			    xstrdup(arg) : derelativise_path(arg);
1441
			    xstrdup(arg) : derelativise_path(arg);
1442
		break;
1442
		break;
Lines 1446-1452 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1446
		if (!arg || *arg == '\0')
1446
		if (!arg || *arg == '\0')
1447
			fatal("%s line %d: missing file name.",
1447
			fatal("%s line %d: missing file name.",
1448
			    filename, linenum);
1448
			    filename, linenum);
1449
		if (*activep)
1449
		if (*activep == 1)
1450
			servconf_add_hostcert(filename, linenum, options, arg);
1450
			servconf_add_hostcert(filename, linenum, options, arg);
1451
		break;
1451
		break;
1452
1452
Lines 1457-1463 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1457
		if (!arg || *arg == '\0')
1457
		if (!arg || *arg == '\0')
1458
			fatal("%s line %d: missing file name.",
1458
			fatal("%s line %d: missing file name.",
1459
			    filename, linenum);
1459
			    filename, linenum);
1460
		if (*activep && *charptr == NULL) {
1460
		if (*activep == 1 && *charptr == NULL) {
1461
			*charptr = derelativise_path(arg);
1461
			*charptr = derelativise_path(arg);
1462
			/* increase optional counter */
1462
			/* increase optional counter */
1463
			if (intptr != NULL)
1463
			if (intptr != NULL)
Lines 1500-1506 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1500
		    arg + 1 : arg, 1))
1500
		    arg + 1 : arg, 1))
1501
			fatal("%s line %d: Bad key types '%s'.",
1501
			fatal("%s line %d: Bad key types '%s'.",
1502
			    filename, linenum, arg ? arg : "<NONE>");
1502
			    filename, linenum, arg ? arg : "<NONE>");
1503
		if (*activep && *charptr == NULL)
1503
		if (*activep == 1 && *charptr == NULL)
1504
			*charptr = xstrdup(arg);
1504
			*charptr = xstrdup(arg);
1505
		break;
1505
		break;
1506
1506
Lines 1534-1540 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1534
				    filename, linenum, arg);
1534
				    filename, linenum, arg);
1535
			}
1535
			}
1536
		}
1536
		}
1537
		if (*activep && *intptr == -1)
1537
		if (*activep == 1 && *intptr == -1)
1538
			*intptr = value;
1538
			*intptr = value;
1539
		break;
1539
		break;
1540
1540
Lines 1601-1607 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1601
		if ((errstr = atoi_err(arg, &value)) != NULL)
1601
		if ((errstr = atoi_err(arg, &value)) != NULL)
1602
			fatal("%s line %d: integer value %s.",
1602
			fatal("%s line %d: integer value %s.",
1603
			    filename, linenum, errstr);
1603
			    filename, linenum, errstr);
1604
		if (*activep && *intptr == -1)
1604
		if (*activep == 1 && *intptr == -1)
1605
			*intptr = value;
1605
			*intptr = value;
1606
		break;
1606
		break;
1607
1607
Lines 1651-1657 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1651
			value = 1;
1651
			value = 1;
1652
			p = xstrdup(arg);
1652
			p = xstrdup(arg);
1653
		}
1653
		}
1654
		if (*activep && *intptr == -1) {
1654
		if (*activep == 1 && *intptr == -1) {
1655
			*intptr = value;
1655
			*intptr = value;
1656
			*charptr = p;
1656
			*charptr = p;
1657
			p = NULL;
1657
			p = NULL;
Lines 1679-1685 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1679
				fatal("%.200s line %d: RekeyLimit too small",
1679
				fatal("%.200s line %d: RekeyLimit too small",
1680
				    filename, linenum);
1680
				    filename, linenum);
1681
		}
1681
		}
1682
		if (*activep && options->rekey_limit == -1)
1682
		if (*activep == 1 && options->rekey_limit == -1)
1683
			options->rekey_limit = val64;
1683
			options->rekey_limit = val64;
1684
		if (cp != NULL) { /* optional rekey interval present */
1684
		if (cp != NULL) { /* optional rekey interval present */
1685
			if (strcmp(cp, "none") == 0) {
1685
			if (strcmp(cp, "none") == 0) {
Lines 1718-1724 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1718
		if (value == SYSLOG_LEVEL_NOT_SET)
1718
		if (value == SYSLOG_LEVEL_NOT_SET)
1719
			fatal("%.200s line %d: unsupported log level '%s'",
1719
			fatal("%.200s line %d: unsupported log level '%s'",
1720
			    filename, linenum, arg ? arg : "<NONE>");
1720
			    filename, linenum, arg ? arg : "<NONE>");
1721
		if (*activep && *log_level_ptr == -1)
1721
		if (*activep == 1 && *log_level_ptr == -1)
1722
			*log_level_ptr = (LogLevel) value;
1722
			*log_level_ptr = (LogLevel) value;
1723
		break;
1723
		break;
1724
1724
Lines 1745-1751 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1745
			if (match_user(NULL, NULL, NULL, arg) == -1)
1745
			if (match_user(NULL, NULL, NULL, arg) == -1)
1746
				fatal("%s line %d: invalid AllowUsers pattern: "
1746
				fatal("%s line %d: invalid AllowUsers pattern: "
1747
				    "\"%.100s\"", filename, linenum, arg);
1747
				    "\"%.100s\"", filename, linenum, arg);
1748
			if (!*activep)
1748
			if (*activep != 1)
1749
				continue;
1749
				continue;
1750
			array_append(filename, linenum, "AllowUsers",
1750
			array_append(filename, linenum, "AllowUsers",
1751
			    &options->allow_users, &options->num_allow_users,
1751
			    &options->allow_users, &options->num_allow_users,
Lines 1758-1764 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1758
			if (match_user(NULL, NULL, NULL, arg) == -1)
1758
			if (match_user(NULL, NULL, NULL, arg) == -1)
1759
				fatal("%s line %d: invalid DenyUsers pattern: "
1759
				fatal("%s line %d: invalid DenyUsers pattern: "
1760
				    "\"%.100s\"", filename, linenum, arg);
1760
				    "\"%.100s\"", filename, linenum, arg);
1761
			if (!*activep)
1761
			if (*activep != 1)
1762
				continue;
1762
				continue;
1763
			array_append(filename, linenum, "DenyUsers",
1763
			array_append(filename, linenum, "DenyUsers",
1764
			    &options->deny_users, &options->num_deny_users,
1764
			    &options->deny_users, &options->num_deny_users,
Lines 1768-1774 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1768
1768
1769
	case sAllowGroups:
1769
	case sAllowGroups:
1770
		while ((arg = strdelim(&cp)) && *arg != '\0') {
1770
		while ((arg = strdelim(&cp)) && *arg != '\0') {
1771
			if (!*activep)
1771
			if (*activep != 1)
1772
				continue;
1772
				continue;
1773
			array_append(filename, linenum, "AllowGroups",
1773
			array_append(filename, linenum, "AllowGroups",
1774
			    &options->allow_groups, &options->num_allow_groups,
1774
			    &options->allow_groups, &options->num_allow_groups,
Lines 1778-1784 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1778
1778
1779
	case sDenyGroups:
1779
	case sDenyGroups:
1780
		while ((arg = strdelim(&cp)) && *arg != '\0') {
1780
		while ((arg = strdelim(&cp)) && *arg != '\0') {
1781
			if (!*activep)
1781
			if (*activep != 1)
1782
				continue;
1782
				continue;
1783
			array_append(filename, linenum, "DenyGroups",
1783
			array_append(filename, linenum, "DenyGroups",
1784
			    &options->deny_groups, &options->num_deny_groups,
1784
			    &options->deny_groups, &options->num_deny_groups,
Lines 1833-1839 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1833
		if (!arg || *arg == '\0')
1833
		if (!arg || *arg == '\0')
1834
			fatal("%s line %d: Missing subsystem name.",
1834
			fatal("%s line %d: Missing subsystem name.",
1835
			    filename, linenum);
1835
			    filename, linenum);
1836
		if (!*activep) {
1836
		if (*activep != 1) {
1837
			arg = strdelim(&cp);
1837
			arg = strdelim(&cp);
1838
			break;
1838
			break;
1839
		}
1839
		}
Lines 1902-1908 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1902
	 * AuthorizedKeysFile	/etc/ssh_keys/%u
1902
	 * AuthorizedKeysFile	/etc/ssh_keys/%u
1903
	 */
1903
	 */
1904
	case sAuthorizedKeysFile:
1904
	case sAuthorizedKeysFile:
1905
		if (*activep && options->num_authkeys_files == 0) {
1905
		if (*activep == 1 && options->num_authkeys_files == 0) {
1906
			while ((arg = strdelim(&cp)) && *arg != '\0') {
1906
			while ((arg = strdelim(&cp)) && *arg != '\0') {
1907
				arg = tilde_expand_filename(arg, getuid());
1907
				arg = tilde_expand_filename(arg, getuid());
1908
				array_append(filename, linenum,
1908
				array_append(filename, linenum,
Lines 1920-1926 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1920
		if (!arg || *arg == '\0')
1920
		if (!arg || *arg == '\0')
1921
			fatal("%s line %d: missing file name.",
1921
			fatal("%s line %d: missing file name.",
1922
			    filename, linenum);
1922
			    filename, linenum);
1923
		if (*activep && *charptr == NULL) {
1923
		if (*activep == 1 && *charptr == NULL) {
1924
			*charptr = tilde_expand_filename(arg, getuid());
1924
			*charptr = tilde_expand_filename(arg, getuid());
1925
			/* increase optional counter */
1925
			/* increase optional counter */
1926
			if (intptr != NULL)
1926
			if (intptr != NULL)
Lines 1941-1947 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1941
			if (strchr(arg, '=') != NULL)
1941
			if (strchr(arg, '=') != NULL)
1942
				fatal("%s line %d: Invalid environment name.",
1942
				fatal("%s line %d: Invalid environment name.",
1943
				    filename, linenum);
1943
				    filename, linenum);
1944
			if (!*activep)
1944
			if (*activep != 1)
1945
				continue;
1945
				continue;
1946
			array_append(filename, linenum, "AcceptEnv",
1946
			array_append(filename, linenum, "AcceptEnv",
1947
			    &options->accept_env, &options->num_accept_env,
1947
			    &options->accept_env, &options->num_accept_env,
Lines 1955-1961 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1955
			if (strchr(arg, '=') == NULL)
1955
			if (strchr(arg, '=') == NULL)
1956
				fatal("%s line %d: Invalid environment.",
1956
				fatal("%s line %d: Invalid environment.",
1957
				    filename, linenum);
1957
				    filename, linenum);
1958
			if (!*activep || uvalue != 0)
1958
			if (*activep != 1 || uvalue != 0)
1959
				continue;
1959
				continue;
1960
			array_append(filename, linenum, "SetEnv",
1960
			array_append(filename, linenum, "SetEnv",
1961
			    &options->setenv, &options->num_setenv, arg);
1961
			    &options->setenv, &options->num_setenv, arg);
Lines 1977-1983 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
1977
		if (value == -1)
1977
		if (value == -1)
1978
			fatal("%s line %d: Bad yes/point-to-point/ethernet/"
1978
			fatal("%s line %d: Bad yes/point-to-point/ethernet/"
1979
			    "no argument: %s", filename, linenum, arg);
1979
			    "no argument: %s", filename, linenum, arg);
1980
		if (*activep && *intptr == -1)
1980
		if (*activep == 1 && *intptr == -1)
1981
			*intptr = value;
1981
			*intptr = value;
1982
		break;
1982
		break;
1983
1983
Lines 2006-2011 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2006
				if (strcmp(item->selector, arg) != 0)
2006
				if (strcmp(item->selector, arg) != 0)
2007
					continue;
2007
					continue;
2008
				if (item->filename != NULL) {
2008
				if (item->filename != NULL) {
2009
					debug2("%s line %d: including %s "
2010
					    "depth %d%s", filename, linenum,
2011
					    item->filename, depth,
2012
					    oactive == 1 ? "" : " (parse only)");
2009
					parse_server_config_depth(options,
2013
					parse_server_config_depth(options,
2010
					    item->filename, item->contents,
2014
					    item->filename, item->contents,
2011
					    includes, connectinfo,
2015
					    includes, connectinfo,
Lines 2043-2050 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2043
			if (gbuf.gl_pathc > INT_MAX)
2047
			if (gbuf.gl_pathc > INT_MAX)
2044
				fatal("%s: too many glob results", __func__);
2048
				fatal("%s: too many glob results", __func__);
2045
			for (n = 0; n < (int)gbuf.gl_pathc; n++) {
2049
			for (n = 0; n < (int)gbuf.gl_pathc; n++) {
2046
				debug2("%s line %d: including %s",
2050
				debug2("%s line %d: including %s depth %d%s",
2047
				    filename, linenum, gbuf.gl_pathv[n]);
2051
				    filename, linenum, gbuf.gl_pathv[n],
2052
				    depth, oactive ? "" : " (parse only)");
2048
				item = xcalloc(1, sizeof(*item));
2053
				item = xcalloc(1, sizeof(*item));
2049
				item->selector = strdup(arg);
2054
				item->selector = strdup(arg);
2050
				item->filename = strdup(gbuf.gl_pathv[n]);
2055
				item->filename = strdup(gbuf.gl_pathv[n]);
Lines 2079-2084 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2079
		if (value < 0)
2084
		if (value < 0)
2080
			fatal("%s line %d: Bad Match condition", filename,
2085
			fatal("%s line %d: Bad Match condition", filename,
2081
			    linenum);
2086
			    linenum);
2087
		/* The first match overwrites special value 2 when reparsing */
2082
		*activep = (inc_flags & SSHCFG_NEVERMATCH) ? 0 : value;
2088
		*activep = (inc_flags & SSHCFG_NEVERMATCH) ? 0 : value;
2083
		break;
2089
		break;
2084
2090
Lines 2097-2103 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2097
			    filename, linenum, lookup_opcode_name(opcode));
2103
			    filename, linenum, lookup_opcode_name(opcode));
2098
		uvalue = *uintptr;	/* modified later */
2104
		uvalue = *uintptr;	/* modified later */
2099
		if (strcmp(arg, "any") == 0 || strcmp(arg, "none") == 0) {
2105
		if (strcmp(arg, "any") == 0 || strcmp(arg, "none") == 0) {
2100
			if (*activep && uvalue == 0) {
2106
			if (*activep == 1 && uvalue == 0) {
2101
				*uintptr = 1;
2107
				*uintptr = 1;
2102
				*chararrayptr = xcalloc(1,
2108
				*chararrayptr = xcalloc(1,
2103
				    sizeof(**chararrayptr));
2109
				    sizeof(**chararrayptr));
Lines 2130-2136 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2130
				    filename, linenum,
2136
				    filename, linenum,
2131
				    lookup_opcode_name(opcode));
2137
				    lookup_opcode_name(opcode));
2132
			}
2138
			}
2133
			if (*activep && uvalue == 0) {
2139
			if (*activep == 1 && uvalue == 0) {
2134
				array_append(filename, linenum,
2140
				array_append(filename, linenum,
2135
				    lookup_opcode_name(opcode),
2141
				    lookup_opcode_name(opcode),
2136
				    chararrayptr, uintptr, arg2);
2142
				    chararrayptr, uintptr, arg2);
Lines 2144-2150 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2144
			fatal("%.200s line %d: Missing argument.", filename,
2150
			fatal("%.200s line %d: Missing argument.", filename,
2145
			    linenum);
2151
			    linenum);
2146
		len = strspn(cp, WHITESPACE);
2152
		len = strspn(cp, WHITESPACE);
2147
		if (*activep && options->adm_forced_command == NULL)
2153
		if (*activep == 1 && options->adm_forced_command == NULL)
2148
			options->adm_forced_command = xstrdup(cp + len);
2154
			options->adm_forced_command = xstrdup(cp + len);
2149
		return 0;
2155
		return 0;
2150
2156
Lines 2155-2161 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2155
		if (!arg || *arg == '\0')
2161
		if (!arg || *arg == '\0')
2156
			fatal("%s line %d: missing file name.",
2162
			fatal("%s line %d: missing file name.",
2157
			    filename, linenum);
2163
			    filename, linenum);
2158
		if (*activep && *charptr == NULL)
2164
		if (*activep == 1 && *charptr == NULL)
2159
			*charptr = xstrdup(arg);
2165
			*charptr = xstrdup(arg);
2160
		break;
2166
		break;
2161
2167
Lines 2173-2179 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2173
		if (!arg || *arg == '\0')
2179
		if (!arg || *arg == '\0')
2174
			fatal("%s line %d: missing file name.",
2180
			fatal("%s line %d: missing file name.",
2175
			    filename, linenum);
2181
			    filename, linenum);
2176
		if (*activep && *charptr == NULL) {
2182
		if (*activep == 1 && *charptr == NULL) {
2177
			*charptr = strcasecmp(arg, "internal") == 0 ?
2183
			*charptr = strcasecmp(arg, "internal") == 0 ?
2178
			    xstrdup(arg) : derelativise_path(arg);
2184
			    xstrdup(arg) : derelativise_path(arg);
2179
			/* increase optional counter */
2185
			/* increase optional counter */
Lines 2193-2199 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2193
		else if ((value2 = parse_ipqos(arg)) == -1)
2199
		else if ((value2 = parse_ipqos(arg)) == -1)
2194
			fatal("%s line %d: Bad IPQoS value: %s",
2200
			fatal("%s line %d: Bad IPQoS value: %s",
2195
			    filename, linenum, arg);
2201
			    filename, linenum, arg);
2196
		if (*activep) {
2202
		if (*activep == 1) {
2197
			options->ip_qos_interactive = value;
2203
			options->ip_qos_interactive = value;
2198
			options->ip_qos_bulk = value2;
2204
			options->ip_qos_bulk = value2;
2199
		}
2205
		}
Lines 2204-2210 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2204
			fatal("%.200s line %d: Missing argument.", filename,
2210
			fatal("%.200s line %d: Missing argument.", filename,
2205
			    linenum);
2211
			    linenum);
2206
		len = strspn(cp, WHITESPACE);
2212
		len = strspn(cp, WHITESPACE);
2207
		if (*activep && options->version_addendum == NULL) {
2213
		if (*activep == 1 && options->version_addendum == NULL) {
2208
			if (strcasecmp(cp + len, "none") == 0)
2214
			if (strcasecmp(cp + len, "none") == 0)
2209
				options->version_addendum = xstrdup("");
2215
				options->version_addendum = xstrdup("");
2210
			else if (strchr(cp + len, '\r') != NULL)
2216
			else if (strchr(cp + len, '\r') != NULL)
Lines 2220-2226 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2220
			fatal("%.200s line %d: Missing argument.", filename,
2226
			fatal("%.200s line %d: Missing argument.", filename,
2221
			    linenum);
2227
			    linenum);
2222
		len = strspn(cp, WHITESPACE);
2228
		len = strspn(cp, WHITESPACE);
2223
		if (*activep && options->authorized_keys_command == NULL) {
2229
		if (*activep == 1 && options->authorized_keys_command == NULL) {
2224
			if (cp[len] != '/' && strcasecmp(cp + len, "none") != 0)
2230
			if (cp[len] != '/' && strcasecmp(cp + len, "none") != 0)
2225
				fatal("%.200s line %d: AuthorizedKeysCommand "
2231
				fatal("%.200s line %d: AuthorizedKeysCommand "
2226
				    "must be an absolute path",
2232
				    "must be an absolute path",
Lines 2236-2242 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2236
		if (!arg || *arg == '\0')
2242
		if (!arg || *arg == '\0')
2237
			fatal("%s line %d: missing AuthorizedKeysCommandUser "
2243
			fatal("%s line %d: missing AuthorizedKeysCommandUser "
2238
			    "argument.", filename, linenum);
2244
			    "argument.", filename, linenum);
2239
		if (*activep && *charptr == NULL)
2245
		if (*activep == 1 && *charptr == NULL)
2240
			*charptr = xstrdup(arg);
2246
			*charptr = xstrdup(arg);
2241
		break;
2247
		break;
2242
2248
Lines 2245-2251 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2245
			fatal("%.200s line %d: Missing argument.", filename,
2251
			fatal("%.200s line %d: Missing argument.", filename,
2246
			    linenum);
2252
			    linenum);
2247
		len = strspn(cp, WHITESPACE);
2253
		len = strspn(cp, WHITESPACE);
2248
		if (*activep &&
2254
		if (*activep == 1 &&
2249
		    options->authorized_principals_command == NULL) {
2255
		    options->authorized_principals_command == NULL) {
2250
			if (cp[len] != '/' && strcasecmp(cp + len, "none") != 0)
2256
			if (cp[len] != '/' && strcasecmp(cp + len, "none") != 0)
2251
				fatal("%.200s line %d: "
2257
				fatal("%.200s line %d: "
Lines 2264-2270 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2264
			fatal("%s line %d: missing "
2270
			fatal("%s line %d: missing "
2265
			    "AuthorizedPrincipalsCommandUser argument.",
2271
			    "AuthorizedPrincipalsCommandUser argument.",
2266
			    filename, linenum);
2272
			    filename, linenum);
2267
		if (*activep && *charptr == NULL)
2273
		if (*activep == 1 && *charptr == NULL)
2268
			*charptr = xstrdup(arg);
2274
			*charptr = xstrdup(arg);
2269
		break;
2275
		break;
2270
2276
Lines 2291-2297 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2291
					    filename, linenum);
2297
					    filename, linenum);
2292
				}
2298
				}
2293
				value2 = 1;
2299
				value2 = 1;
2294
				if (!*activep)
2300
				if (*activep != 1)
2295
					continue;
2301
					continue;
2296
				array_append(filename, linenum,
2302
				array_append(filename, linenum,
2297
				    "AuthenticationMethods",
2303
				    "AuthenticationMethods",
Lines 2314-2320 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2314
		value = strtol(arg, &p, 8);
2320
		value = strtol(arg, &p, 8);
2315
		if (arg == p || value < 0 || value > 0777)
2321
		if (arg == p || value < 0 || value > 0777)
2316
			fatal("%s line %d: Bad mask.", filename, linenum);
2322
			fatal("%s line %d: Bad mask.", filename, linenum);
2317
		if (*activep)
2323
		if (*activep == 1)
2318
			options->fwd_opts.streamlocal_bind_mask = (mode_t)value;
2324
			options->fwd_opts.streamlocal_bind_mask = (mode_t)value;
2319
		break;
2325
		break;
2320
2326
Lines 2330-2336 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2330
		if ((value = ssh_digest_alg_by_name(arg)) == -1)
2336
		if ((value = ssh_digest_alg_by_name(arg)) == -1)
2331
			fatal("%.200s line %d: Invalid hash algorithm \"%s\".",
2337
			fatal("%.200s line %d: Invalid hash algorithm \"%s\".",
2332
			    filename, linenum, arg);
2338
			    filename, linenum, arg);
2333
		if (*activep)
2339
		if (*activep == 1)
2334
			options->fingerprint_hash = value;
2340
			options->fingerprint_hash = value;
2335
		break;
2341
		break;
2336
2342
Lines 2348-2354 process_server_config_line_depth(ServerOptions *options, char *line, Link Here
2348
		    !valid_rdomain(arg))
2354
		    !valid_rdomain(arg))
2349
			fatal("%s line %d: bad routing domain",
2355
			fatal("%s line %d: bad routing domain",
2350
			    filename, linenum);
2356
			    filename, linenum);
2351
		if (*activep && *charptr == NULL)
2357
		if (*activep == 1 && *charptr == NULL)
2352
			*charptr = xstrdup(arg);
2358
			*charptr = xstrdup(arg);
2353
		break;
2359
		break;
2354
2360
Lines 2606-2612 parse_server_config(ServerOptions *options, const char *filename, Link Here
2606
    struct sshbuf *conf, struct include_list *includes,
2612
    struct sshbuf *conf, struct include_list *includes,
2607
    struct connection_info *connectinfo)
2613
    struct connection_info *connectinfo)
2608
{
2614
{
2609
	int active = connectinfo ? 0 : 1;
2615
	int active = connectinfo ? 2 : 1;
2610
	parse_server_config_depth(options, filename, conf, includes,
2616
	parse_server_config_depth(options, filename, conf, includes,
2611
	    connectinfo, 0, &active, 0);
2617
	    connectinfo, 0, &active, 0);
2612
}
2618
}

Return to bug 3122