summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/servconf.c b/servconf.c
index 70f5f73f0..ba0a92c7b 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
@@ -626,7 +626,7 @@ static struct {
626#else 626#else
627 { "printlastlog", sPrintLastLog, SSHCFG_GLOBAL }, 627 { "printlastlog", sPrintLastLog, SSHCFG_GLOBAL },
628#endif 628#endif
629 { "ignorerhosts", sIgnoreRhosts, SSHCFG_GLOBAL }, 629 { "ignorerhosts", sIgnoreRhosts, SSHCFG_ALL },
630 { "ignoreuserknownhosts", sIgnoreUserKnownHosts, SSHCFG_GLOBAL }, 630 { "ignoreuserknownhosts", sIgnoreUserKnownHosts, SSHCFG_GLOBAL },
631 { "x11forwarding", sX11Forwarding, SSHCFG_ALL }, 631 { "x11forwarding", sX11Forwarding, SSHCFG_ALL },
632 { "x11displayoffset", sX11DisplayOffset, SSHCFG_ALL }, 632 { "x11displayoffset", sX11DisplayOffset, SSHCFG_ALL },
@@ -1213,6 +1213,12 @@ static const struct multistate multistate_flag[] = {
1213 { "no", 0 }, 1213 { "no", 0 },
1214 { NULL, -1 } 1214 { NULL, -1 }
1215}; 1215};
1216static const struct multistate multistate_ignore_rhosts[] = {
1217 { "yes", IGNORE_RHOSTS_YES },
1218 { "no", IGNORE_RHOSTS_NO },
1219 { "shosts-only", IGNORE_RHOSTS_SHOSTS },
1220 { NULL, -1 }
1221};
1216static const struct multistate multistate_addressfamily[] = { 1222static const struct multistate multistate_addressfamily[] = {
1217 { "inet", AF_INET }, 1223 { "inet", AF_INET },
1218 { "inet6", AF_INET6 }, 1224 { "inet6", AF_INET6 },
@@ -1462,13 +1468,14 @@ process_server_config_line_depth(ServerOptions *options, char *line,
1462 1468
1463 case sIgnoreRhosts: 1469 case sIgnoreRhosts:
1464 intptr = &options->ignore_rhosts; 1470 intptr = &options->ignore_rhosts;
1465 parse_flag: 1471 multistate_ptr = multistate_ignore_rhosts;
1466 multistate_ptr = multistate_flag;
1467 goto parse_multistate; 1472 goto parse_multistate;
1468 1473
1469 case sIgnoreUserKnownHosts: 1474 case sIgnoreUserKnownHosts:
1470 intptr = &options->ignore_user_known_hosts; 1475 intptr = &options->ignore_user_known_hosts;
1471 goto parse_flag; 1476 parse_flag:
1477 multistate_ptr = multistate_flag;
1478 goto parse_multistate;
1472 1479
1473 case sHostbasedAuthentication: 1480 case sHostbasedAuthentication:
1474 intptr = &options->hostbased_authentication; 1481 intptr = &options->hostbased_authentication;
@@ -1977,7 +1984,7 @@ process_server_config_line_depth(ServerOptions *options, char *line,
1977 value++; 1984 value++;
1978 found = 0; 1985 found = 0;
1979 if (*arg2 != '/' && *arg2 != '~') { 1986 if (*arg2 != '/' && *arg2 != '~') {
1980 xasprintf(&arg, "%s/%s", SSHDIR, arg); 1987 xasprintf(&arg, "%s/%s", SSHDIR, arg2);
1981 } else 1988 } else
1982 arg = xstrdup(arg2); 1989 arg = xstrdup(arg2);
1983 1990
@@ -2325,6 +2332,10 @@ process_server_config_line_depth(ServerOptions *options, char *line,
2325 goto parse_flag; 2332 goto parse_flag;
2326 2333
2327 case sRDomain: 2334 case sRDomain:
2335#if !defined(__OpenBSD__) && !defined(HAVE_SYS_SET_PROCESS_RDOMAIN)
2336 fatal("%s line %d: setting RDomain not supported on this "
2337 "platform.", filename, linenum);
2338#endif
2328 charptr = &options->routing_domain; 2339 charptr = &options->routing_domain;
2329 arg = strdelim(&cp); 2340 arg = strdelim(&cp);
2330 if (!arg || *arg == '\0') 2341 if (!arg || *arg == '\0')
@@ -2473,6 +2484,7 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth)
2473 M_CP_INTOPT(kbd_interactive_authentication); 2484 M_CP_INTOPT(kbd_interactive_authentication);
2474 M_CP_INTOPT(permit_root_login); 2485 M_CP_INTOPT(permit_root_login);
2475 M_CP_INTOPT(permit_empty_passwd); 2486 M_CP_INTOPT(permit_empty_passwd);
2487 M_CP_INTOPT(ignore_rhosts);
2476 2488
2477 M_CP_INTOPT(allow_tcp_forwarding); 2489 M_CP_INTOPT(allow_tcp_forwarding);
2478 M_CP_INTOPT(allow_streamlocal_forwarding); 2490 M_CP_INTOPT(allow_streamlocal_forwarding);
@@ -2627,6 +2639,8 @@ fmt_intarg(ServerOpCodes code, int val)
2627 return fmt_multistate_int(val, multistate_tcpfwd); 2639 return fmt_multistate_int(val, multistate_tcpfwd);
2628 case sAllowStreamLocalForwarding: 2640 case sAllowStreamLocalForwarding:
2629 return fmt_multistate_int(val, multistate_tcpfwd); 2641 return fmt_multistate_int(val, multistate_tcpfwd);
2642 case sIgnoreRhosts:
2643 return fmt_multistate_int(val, multistate_ignore_rhosts);
2630 case sFingerprintHash: 2644 case sFingerprintHash:
2631 return ssh_digest_alg_name(val); 2645 return ssh_digest_alg_name(val);
2632 default: 2646 default:
@@ -2830,7 +2844,9 @@ dump_config(ServerOptions *o)
2830 dump_cfg_string(sHostbasedAcceptedKeyTypes, o->hostbased_key_types); 2844 dump_cfg_string(sHostbasedAcceptedKeyTypes, o->hostbased_key_types);
2831 dump_cfg_string(sHostKeyAlgorithms, o->hostkeyalgorithms); 2845 dump_cfg_string(sHostKeyAlgorithms, o->hostkeyalgorithms);
2832 dump_cfg_string(sPubkeyAcceptedKeyTypes, o->pubkey_key_types); 2846 dump_cfg_string(sPubkeyAcceptedKeyTypes, o->pubkey_key_types);
2847#if defined(__OpenBSD__) || defined(HAVE_SYS_SET_PROCESS_RDOMAIN)
2833 dump_cfg_string(sRDomain, o->routing_domain); 2848 dump_cfg_string(sRDomain, o->routing_domain);
2849#endif
2834 2850
2835 /* string arguments requiring a lookup */ 2851 /* string arguments requiring a lookup */
2836 dump_cfg_string(sLogLevel, log_level_name(o->log_level)); 2852 dump_cfg_string(sLogLevel, log_level_name(o->log_level));