mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Merge remote-tracking branch 'jryans/log-severity'
This commit is contained in:
commit
b659ffe9ac
3
changes/19965
Normal file
3
changes/19965
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Minor bugfix (configuration):
|
||||||
|
- Accept non-space whitespace characters after the severity level in the
|
||||||
|
`Log` option. Fixes bug 19965; bugfix on 0.2.1.1-alpha.
|
@ -1319,10 +1319,8 @@ parse_log_severity_config(const char **cfg_ptr,
|
|||||||
if (got_an_unqualified_range > 1)
|
if (got_an_unqualified_range > 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
space = strchr(cfg, ' ');
|
space = find_whitespace(cfg);
|
||||||
dash = strchr(cfg, '-');
|
dash = strchr(cfg, '-');
|
||||||
if (!space)
|
|
||||||
space = strchr(cfg, '\0');
|
|
||||||
if (dash && dash < space) {
|
if (dash && dash < space) {
|
||||||
sev_lo = tor_strndup(cfg, dash-cfg);
|
sev_lo = tor_strndup(cfg, dash-cfg);
|
||||||
sev_hi = tor_strndup(dash+1, space-(dash+1));
|
sev_hi = tor_strndup(dash+1, space-(dash+1));
|
||||||
|
@ -4890,6 +4890,33 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|||||||
config_free_lines(config_port_valid); config_port_valid = NULL;
|
config_free_lines(config_port_valid); config_port_valid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_config_parse_log_severity(void *data)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
const char *severity_log_lines[] = {
|
||||||
|
"debug file /tmp/debug.log",
|
||||||
|
"debug\tfile /tmp/debug.log",
|
||||||
|
"[handshake]debug [~net,~mm]info notice stdout",
|
||||||
|
"[handshake]debug\t[~net,~mm]info\tnotice\tstdout",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
log_severity_list_t *severity;
|
||||||
|
|
||||||
|
(void) data;
|
||||||
|
|
||||||
|
severity = tor_malloc(sizeof(log_severity_list_t));
|
||||||
|
for (i = 0; severity_log_lines[i]; i++) {
|
||||||
|
memset(severity, 0, sizeof(log_severity_list_t));
|
||||||
|
ret = parse_log_severity_config(&severity_log_lines[i], severity);
|
||||||
|
tt_int_op(ret, OP_EQ, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
tor_free(severity);
|
||||||
|
}
|
||||||
|
|
||||||
#define CONFIG_TEST(name, flags) \
|
#define CONFIG_TEST(name, flags) \
|
||||||
{ #name, test_config_ ## name, flags, NULL, NULL }
|
{ #name, test_config_ ## name, flags, NULL, NULL }
|
||||||
|
|
||||||
@ -4916,6 +4943,6 @@ struct testcase_t config_tests[] = {
|
|||||||
CONFIG_TEST(parse_port_config__ports__no_ports_given, 0),
|
CONFIG_TEST(parse_port_config__ports__no_ports_given, 0),
|
||||||
CONFIG_TEST(parse_port_config__ports__server_options, 0),
|
CONFIG_TEST(parse_port_config__ports__server_options, 0),
|
||||||
CONFIG_TEST(parse_port_config__ports__ports_given, 0),
|
CONFIG_TEST(parse_port_config__ports__ports_given, 0),
|
||||||
|
CONFIG_TEST(parse_log_severity, 0),
|
||||||
END_OF_TESTCASES
|
END_OF_TESTCASES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user