diff options
Diffstat (limited to 'servconf.c')
-rw-r--r-- | servconf.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/servconf.c b/servconf.c index 470ad3619..c290e9786 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | /* $OpenBSD: servconf.c,v 1.360 2020/01/31 22:42:45 djm Exp $ */ | 2 | /* $OpenBSD: servconf.c,v 1.363 2020/04/17 03:30:05 djm Exp $ */ |
3 | /* | 3 | /* |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
5 | * All rights reserved | 5 | * All rights reserved |
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <sys/types.h> | 16 | #include <sys/types.h> |
17 | #include <sys/socket.h> | 17 | #include <sys/socket.h> |
18 | #ifdef HAVE_SYS_SYSCTL_H | 18 | #ifdef __OpenBSD__ |
19 | #include <sys/sysctl.h> | 19 | #include <sys/sysctl.h> |
20 | #endif | 20 | #endif |
21 | 21 | ||
@@ -653,7 +653,7 @@ static struct { | |||
653 | #else | 653 | #else |
654 | { "printlastlog", sPrintLastLog, SSHCFG_GLOBAL }, | 654 | { "printlastlog", sPrintLastLog, SSHCFG_GLOBAL }, |
655 | #endif | 655 | #endif |
656 | { "ignorerhosts", sIgnoreRhosts, SSHCFG_GLOBAL }, | 656 | { "ignorerhosts", sIgnoreRhosts, SSHCFG_ALL }, |
657 | { "ignoreuserknownhosts", sIgnoreUserKnownHosts, SSHCFG_GLOBAL }, | 657 | { "ignoreuserknownhosts", sIgnoreUserKnownHosts, SSHCFG_GLOBAL }, |
658 | { "x11forwarding", sX11Forwarding, SSHCFG_ALL }, | 658 | { "x11forwarding", sX11Forwarding, SSHCFG_ALL }, |
659 | { "x11displayoffset", sX11DisplayOffset, SSHCFG_ALL }, | 659 | { "x11displayoffset", sX11DisplayOffset, SSHCFG_ALL }, |
@@ -1242,6 +1242,12 @@ static const struct multistate multistate_flag[] = { | |||
1242 | { "no", 0 }, | 1242 | { "no", 0 }, |
1243 | { NULL, -1 } | 1243 | { NULL, -1 } |
1244 | }; | 1244 | }; |
1245 | static const struct multistate multistate_ignore_rhosts[] = { | ||
1246 | { "yes", IGNORE_RHOSTS_YES }, | ||
1247 | { "no", IGNORE_RHOSTS_NO }, | ||
1248 | { "shosts-only", IGNORE_RHOSTS_SHOSTS }, | ||
1249 | { NULL, -1 } | ||
1250 | }; | ||
1245 | static const struct multistate multistate_addressfamily[] = { | 1251 | static const struct multistate multistate_addressfamily[] = { |
1246 | { "inet", AF_INET }, | 1252 | { "inet", AF_INET }, |
1247 | { "inet6", AF_INET6 }, | 1253 | { "inet6", AF_INET6 }, |
@@ -1491,13 +1497,14 @@ process_server_config_line_depth(ServerOptions *options, char *line, | |||
1491 | 1497 | ||
1492 | case sIgnoreRhosts: | 1498 | case sIgnoreRhosts: |
1493 | intptr = &options->ignore_rhosts; | 1499 | intptr = &options->ignore_rhosts; |
1494 | parse_flag: | 1500 | multistate_ptr = multistate_ignore_rhosts; |
1495 | multistate_ptr = multistate_flag; | ||
1496 | goto parse_multistate; | 1501 | goto parse_multistate; |
1497 | 1502 | ||
1498 | case sIgnoreUserKnownHosts: | 1503 | case sIgnoreUserKnownHosts: |
1499 | intptr = &options->ignore_user_known_hosts; | 1504 | intptr = &options->ignore_user_known_hosts; |
1500 | goto parse_flag; | 1505 | parse_flag: |
1506 | multistate_ptr = multistate_flag; | ||
1507 | goto parse_multistate; | ||
1501 | 1508 | ||
1502 | case sHostbasedAuthentication: | 1509 | case sHostbasedAuthentication: |
1503 | intptr = &options->hostbased_authentication; | 1510 | intptr = &options->hostbased_authentication; |
@@ -2026,7 +2033,7 @@ process_server_config_line_depth(ServerOptions *options, char *line, | |||
2026 | value++; | 2033 | value++; |
2027 | found = 0; | 2034 | found = 0; |
2028 | if (*arg2 != '/' && *arg2 != '~') { | 2035 | if (*arg2 != '/' && *arg2 != '~') { |
2029 | xasprintf(&arg, "%s/%s", SSHDIR, arg); | 2036 | xasprintf(&arg, "%s/%s", SSHDIR, arg2); |
2030 | } else | 2037 | } else |
2031 | arg = xstrdup(arg2); | 2038 | arg = xstrdup(arg2); |
2032 | 2039 | ||
@@ -2374,6 +2381,10 @@ process_server_config_line_depth(ServerOptions *options, char *line, | |||
2374 | goto parse_flag; | 2381 | goto parse_flag; |
2375 | 2382 | ||
2376 | case sRDomain: | 2383 | case sRDomain: |
2384 | #if !defined(__OpenBSD__) && !defined(HAVE_SYS_SET_PROCESS_RDOMAIN) | ||
2385 | fatal("%s line %d: setting RDomain not supported on this " | ||
2386 | "platform.", filename, linenum); | ||
2387 | #endif | ||
2377 | charptr = &options->routing_domain; | 2388 | charptr = &options->routing_domain; |
2378 | arg = strdelim(&cp); | 2389 | arg = strdelim(&cp); |
2379 | if (!arg || *arg == '\0') | 2390 | if (!arg || *arg == '\0') |
@@ -2526,6 +2537,7 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth) | |||
2526 | M_CP_INTOPT(kbd_interactive_authentication); | 2537 | M_CP_INTOPT(kbd_interactive_authentication); |
2527 | M_CP_INTOPT(permit_root_login); | 2538 | M_CP_INTOPT(permit_root_login); |
2528 | M_CP_INTOPT(permit_empty_passwd); | 2539 | M_CP_INTOPT(permit_empty_passwd); |
2540 | M_CP_INTOPT(ignore_rhosts); | ||
2529 | 2541 | ||
2530 | M_CP_INTOPT(allow_tcp_forwarding); | 2542 | M_CP_INTOPT(allow_tcp_forwarding); |
2531 | M_CP_INTOPT(allow_streamlocal_forwarding); | 2543 | M_CP_INTOPT(allow_streamlocal_forwarding); |
@@ -2680,6 +2692,8 @@ fmt_intarg(ServerOpCodes code, int val) | |||
2680 | return fmt_multistate_int(val, multistate_tcpfwd); | 2692 | return fmt_multistate_int(val, multistate_tcpfwd); |
2681 | case sAllowStreamLocalForwarding: | 2693 | case sAllowStreamLocalForwarding: |
2682 | return fmt_multistate_int(val, multistate_tcpfwd); | 2694 | return fmt_multistate_int(val, multistate_tcpfwd); |
2695 | case sIgnoreRhosts: | ||
2696 | return fmt_multistate_int(val, multistate_ignore_rhosts); | ||
2683 | case sFingerprintHash: | 2697 | case sFingerprintHash: |
2684 | return ssh_digest_alg_name(val); | 2698 | return ssh_digest_alg_name(val); |
2685 | default: | 2699 | default: |
@@ -2887,7 +2901,9 @@ dump_config(ServerOptions *o) | |||
2887 | dump_cfg_string(sHostbasedAcceptedKeyTypes, o->hostbased_key_types); | 2901 | dump_cfg_string(sHostbasedAcceptedKeyTypes, o->hostbased_key_types); |
2888 | dump_cfg_string(sHostKeyAlgorithms, o->hostkeyalgorithms); | 2902 | dump_cfg_string(sHostKeyAlgorithms, o->hostkeyalgorithms); |
2889 | dump_cfg_string(sPubkeyAcceptedKeyTypes, o->pubkey_key_types); | 2903 | dump_cfg_string(sPubkeyAcceptedKeyTypes, o->pubkey_key_types); |
2904 | #if defined(__OpenBSD__) || defined(HAVE_SYS_SET_PROCESS_RDOMAIN) | ||
2890 | dump_cfg_string(sRDomain, o->routing_domain); | 2905 | dump_cfg_string(sRDomain, o->routing_domain); |
2906 | #endif | ||
2891 | 2907 | ||
2892 | /* string arguments requiring a lookup */ | 2908 | /* string arguments requiring a lookup */ |
2893 | dump_cfg_string(sLogLevel, log_level_name(o->log_level)); | 2909 | dump_cfg_string(sLogLevel, log_level_name(o->log_level)); |