Skip to content

Commit

Permalink
Merge branch 'tor-github/pr/1065' into maint-0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
asn-d6 committed Jun 11, 2019
2 parents 2779ce1 + 3c3158f commit eab9dc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions changes/bug22619
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
o Minor bugfixes (circuit isolation):
- Fix a logic error that prevented the SessionGroup sub-option from
being accepted. Fixes bug 22619; bugfix on 0.2.7.2-alpha.
2 changes: 1 addition & 1 deletion src/app/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 5 additions & 7 deletions src/test/test_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit eab9dc0

Please sign in to comment.