diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-06-11 13:48:16 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-06-11 13:48:16 +0300 |
commit | b83dba7cb0dbd96c2be09edab47e6c16491c0a14 (patch) | |
tree | d1cfaaefacc3c527d8b4f0c89cc166ffd8537485 /src | |
parent | ece5133e0dbc9049e09d7104cc5cf21630902fa7 (diff) | |
parent | eab9dc06af32ceb3826d068cf5bc55db68ad6c61 (diff) | |
download | tor-b83dba7cb0dbd96c2be09edab47e6c16491c0a14.tar.gz tor-b83dba7cb0dbd96c2be09edab47e6c16491c0a14.zip |
Merge branch 'maint-0.4.1'
Diffstat (limited to 'src')
-rw-r--r-- | src/app/config/config.c | 2 | ||||
-rw-r--r-- | src/test/test_config.c | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index 4cbe81026c..a061871748 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -7091,7 +7091,7 @@ parse_port_config(smartlist_t *out, if (!strcasecmpstart(elt, "SessionGroup=")) { int group = (int)tor_parse_long(elt+strlen("SessionGroup="), 10, 0, INT_MAX, &ok, NULL); - if (!ok || !allow_no_stream_options) { + if (!ok || allow_no_stream_options) { log_warn(LD_CONFIG, "Invalid %sPort option '%s'", portname, escaped(elt)); goto err; diff --git a/src/test/test_config.c b/src/test/test_config.c index 12b78f806a..a415ca4480 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -4569,16 +4569,14 @@ test_config_parse_port_config__ports__ports_given(void *data) "127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS); tt_int_op(ret, OP_EQ, -1); - // TODO: this seems wrong. Shouldn't it be the other way around? - // Potential bug. - // Test failure for a SessionGroup argument with valid value but with stream - // options allowed + // Test failure for a SessionGroup argument with valid value but with no + // stream options allowed config_free_lines(config_port_invalid); config_port_invalid = NULL; SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf)); smartlist_clear(slout); config_port_invalid = mock_config_line("DNSPort", "42 SessionGroup=123"); ret = parse_port_config(slout, config_port_invalid, "DNS", 0, - "127.0.0.44", 0, 0); + "127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS); tt_int_op(ret, OP_EQ, -1); // Test failure for more than one SessionGroup argument @@ -4588,7 +4586,7 @@ test_config_parse_port_config__ports__ports_given(void *data) config_port_invalid = mock_config_line("DNSPort", "42 SessionGroup=123 " "SessionGroup=321"); ret = parse_port_config(slout, config_port_invalid, "DNS", 0, - "127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS); + "127.0.0.44", 0, 0); tt_int_op(ret, OP_EQ, -1); // Test success with a sessiongroup options @@ -4597,7 +4595,7 @@ test_config_parse_port_config__ports__ports_given(void *data) smartlist_clear(slout); config_port_valid = mock_config_line("DNSPort", "42 SessionGroup=1111122"); ret = parse_port_config(slout, config_port_valid, "DNS", 0, - "127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS); + "127.0.0.44", 0, 0); tt_int_op(ret, OP_EQ, 0); tt_int_op(smartlist_len(slout), OP_EQ, 1); port_cfg = (port_cfg_t *)smartlist_get(slout, 0); |