|
Lines 554-559
typedef enum {
Link Here
|
| 554 |
#define SSHCFG_MATCH 0x02 /* allowed inside a Match section */ |
554 |
#define SSHCFG_MATCH 0x02 /* allowed inside a Match section */ |
| 555 |
#define SSHCFG_ALL (SSHCFG_GLOBAL|SSHCFG_MATCH) |
555 |
#define SSHCFG_ALL (SSHCFG_GLOBAL|SSHCFG_MATCH) |
| 556 |
#define SSHCFG_NEVERMATCH 0x04 /* Match never matches; internal only */ |
556 |
#define SSHCFG_NEVERMATCH 0x04 /* Match never matches; internal only */ |
|
|
557 |
#define SSHCFG_MATCH_ONLY 0x08 /* Match only in conditional blocks; internal only */ |
| 557 |
|
558 |
|
| 558 |
/* Textual representation of the tokens. */ |
559 |
/* Textual representation of the tokens. */ |
| 559 |
static struct { |
560 |
static struct { |
|
Lines 1265-1271
static const struct multistate multistate_tcpfwd[] = {
Link Here
|
| 1265 |
static int |
1266 |
static int |
| 1266 |
process_server_config_line_depth(ServerOptions *options, char *line, |
1267 |
process_server_config_line_depth(ServerOptions *options, char *line, |
| 1267 |
const char *filename, int linenum, int *activep, |
1268 |
const char *filename, int linenum, int *activep, |
| 1268 |
struct connection_info *connectinfo, int inc_flags, int depth, |
1269 |
struct connection_info *connectinfo, int *inc_flags, int depth, |
| 1269 |
struct include_list *includes) |
1270 |
struct include_list *includes) |
| 1270 |
{ |
1271 |
{ |
| 1271 |
char ch, *cp, ***chararrayptr, **charptr, *arg, *arg2, *p; |
1272 |
char ch, *cp, ***chararrayptr, **charptr, *arg, *arg2, *p; |
|
Lines 2012-2018
process_server_config_line_depth(ServerOptions *options, char *line,
Link Here
|
| 2012 |
parse_server_config_depth(options, |
2013 |
parse_server_config_depth(options, |
| 2013 |
item->filename, item->contents, |
2014 |
item->filename, item->contents, |
| 2014 |
includes, connectinfo, |
2015 |
includes, connectinfo, |
| 2015 |
(oactive ? 0 : SSHCFG_NEVERMATCH), |
2016 |
(*inc_flags & SSHCFG_MATCH_ONLY |
|
|
2017 |
? SSHCFG_MATCH_ONLY : (oactive |
| 2018 |
? 0 : SSHCFG_NEVERMATCH)), |
| 2016 |
activep, depth + 1); |
2019 |
activep, depth + 1); |
| 2017 |
} |
2020 |
} |
| 2018 |
found = 1; |
2021 |
found = 1; |
|
Lines 2060-2066
process_server_config_line_depth(ServerOptions *options, char *line,
Link Here
|
| 2060 |
parse_server_config_depth(options, |
2063 |
parse_server_config_depth(options, |
| 2061 |
item->filename, item->contents, |
2064 |
item->filename, item->contents, |
| 2062 |
includes, connectinfo, |
2065 |
includes, connectinfo, |
| 2063 |
(oactive ? 0 : SSHCFG_NEVERMATCH), |
2066 |
(*inc_flags & SSHCFG_MATCH_ONLY |
|
|
2067 |
? SSHCFG_MATCH_ONLY : (oactive |
| 2068 |
? 0 : SSHCFG_NEVERMATCH)), |
| 2064 |
activep, depth + 1); |
2069 |
activep, depth + 1); |
| 2065 |
*activep = oactive; |
2070 |
*activep = oactive; |
| 2066 |
TAILQ_INSERT_TAIL(includes, item, entry); |
2071 |
TAILQ_INSERT_TAIL(includes, item, entry); |
|
Lines 2078-2088
process_server_config_line_depth(ServerOptions *options, char *line,
Link Here
|
| 2078 |
if (cmdline) |
2083 |
if (cmdline) |
| 2079 |
fatal("Match directive not supported as a command-line " |
2084 |
fatal("Match directive not supported as a command-line " |
| 2080 |
"option"); |
2085 |
"option"); |
| 2081 |
value = match_cfg_line(&cp, linenum, connectinfo); |
2086 |
value = match_cfg_line(&cp, linenum, |
|
|
2087 |
(*inc_flags & SSHCFG_NEVERMATCH ? NULL : connectinfo)); |
| 2082 |
if (value < 0) |
2088 |
if (value < 0) |
| 2083 |
fatal("%s line %d: Bad Match condition", filename, |
2089 |
fatal("%s line %d: Bad Match condition", filename, |
| 2084 |
linenum); |
2090 |
linenum); |
| 2085 |
*activep = (inc_flags & SSHCFG_NEVERMATCH) ? 0 : value; |
2091 |
*activep = (*inc_flags & SSHCFG_NEVERMATCH) ? 0 : value; |
|
|
2092 |
/* The MATCH_ONLY is applicable only until the first match block */ |
| 2093 |
*inc_flags &= ~SSHCFG_MATCH_ONLY; |
| 2086 |
break; |
2094 |
break; |
| 2087 |
|
2095 |
|
| 2088 |
case sPermitListen: |
2096 |
case sPermitListen: |
|
Lines 2385-2392
process_server_config_line(ServerOptions *options, char *line,
Link Here
|
| 2385 |
const char *filename, int linenum, int *activep, |
2393 |
const char *filename, int linenum, int *activep, |
| 2386 |
struct connection_info *connectinfo, struct include_list *includes) |
2394 |
struct connection_info *connectinfo, struct include_list *includes) |
| 2387 |
{ |
2395 |
{ |
|
|
2396 |
int inc_flags = 0; |
| 2388 |
return process_server_config_line_depth(options, line, filename, |
2397 |
return process_server_config_line_depth(options, line, filename, |
| 2389 |
linenum, activep, connectinfo, 0, 0, includes); |
2398 |
linenum, activep, connectinfo, &inc_flags, 0, includes); |
| 2390 |
} |
2399 |
} |
| 2391 |
|
2400 |
|
| 2392 |
|
2401 |
|
|
Lines 2591-2604
parse_server_config_depth(ServerOptions *options, const char *filename,
Link Here
|
| 2591 |
if (depth < 0 || depth > SERVCONF_MAX_DEPTH) |
2600 |
if (depth < 0 || depth > SERVCONF_MAX_DEPTH) |
| 2592 |
fatal("Too many recursive configuration includes"); |
2601 |
fatal("Too many recursive configuration includes"); |
| 2593 |
|
2602 |
|
| 2594 |
debug2("%s: config %s len %zu", __func__, filename, sshbuf_len(conf)); |
2603 |
debug2("%s: config %s len %zu%s", __func__, filename, sshbuf_len(conf), |
|
|
2604 |
(flags & SSHCFG_NEVERMATCH ? " [checking syntax only]" : "")); |
| 2595 |
|
2605 |
|
| 2596 |
if ((obuf = cbuf = sshbuf_dup_string(conf)) == NULL) |
2606 |
if ((obuf = cbuf = sshbuf_dup_string(conf)) == NULL) |
| 2597 |
fatal("%s: sshbuf_dup_string failed", __func__); |
2607 |
fatal("%s: sshbuf_dup_string failed", __func__); |
| 2598 |
linenum = 1; |
2608 |
linenum = 1; |
| 2599 |
while ((cp = strsep(&cbuf, "\n")) != NULL) { |
2609 |
while ((cp = strsep(&cbuf, "\n")) != NULL) { |
| 2600 |
if (process_server_config_line_depth(options, cp, |
2610 |
if (process_server_config_line_depth(options, cp, |
| 2601 |
filename, linenum++, activep, connectinfo, flags, |
2611 |
filename, linenum++, activep, connectinfo, &flags, |
| 2602 |
depth, includes) != 0) |
2612 |
depth, includes) != 0) |
| 2603 |
bad_options++; |
2613 |
bad_options++; |
| 2604 |
} |
2614 |
} |
|
Lines 2615-2621
parse_server_config(ServerOptions *options, const char *filename,
Link Here
|
| 2615 |
{ |
2625 |
{ |
| 2616 |
int active = connectinfo ? 0 : 1; |
2626 |
int active = connectinfo ? 0 : 1; |
| 2617 |
parse_server_config_depth(options, filename, conf, includes, |
2627 |
parse_server_config_depth(options, filename, conf, includes, |
| 2618 |
connectinfo, 0, &active, 0); |
2628 |
connectinfo, (connectinfo ? SSHCFG_MATCH_ONLY : 0), &active, 0); |
| 2619 |
process_queued_listen_addrs(options); |
2629 |
process_queued_listen_addrs(options); |
| 2620 |
} |
2630 |
} |
| 2621 |
|
2631 |
|
| 2622 |
- |
|
|