|
@@ -3863,144 +3863,6 @@ mock_config_line(const char *key, const char *val)
|
|
|
return config_line;
|
|
|
}
|
|
|
|
|
|
-static void
|
|
|
-test_config_parse_port_config__listenaddress(void *data)
|
|
|
-{
|
|
|
- (void)data;
|
|
|
- int ret;
|
|
|
- config_line_t *config_listen_address = NULL, *config_listen_address2 = NULL,
|
|
|
- *config_listen_address3 = NULL;
|
|
|
- config_line_t *config_port1 = NULL, *config_port2 = NULL,
|
|
|
- *config_port3 = NULL, *config_port4 = NULL, *config_port5 = NULL;
|
|
|
- smartlist_t *slout = NULL;
|
|
|
- port_cfg_t *port_cfg = NULL;
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(NULL, NULL, NULL, NULL, 0, NULL, 0, 0);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
-
|
|
|
-
|
|
|
- config_listen_address = mock_config_line("DNSListenAddress", "127.0.0.1");
|
|
|
- config_listen_address2 = mock_config_line("DNSListenAddress", "x$$$:::345");
|
|
|
- config_listen_address3 = mock_config_line("DNSListenAddress",
|
|
|
- "127.0.0.1:1442");
|
|
|
- config_port1 = mock_config_line("DNSPort", "42");
|
|
|
- config_port2 = mock_config_line("DNSPort", "43");
|
|
|
- config_port1->next = config_port2;
|
|
|
- config_port3 = mock_config_line("DNSPort", "auto");
|
|
|
- config_port4 = mock_config_line("DNSPort", "55542");
|
|
|
- config_port5 = mock_config_line("DNSPort", "666777");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(NULL, config_port1, config_listen_address, "DNS", 0,
|
|
|
- NULL, 0, 0);
|
|
|
-
|
|
|
- tt_int_op(ret, OP_EQ, -1);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(NULL, NULL, config_listen_address, "DNS", 0, NULL,
|
|
|
- 0, CL_PORT_ALLOW_EXTRA_LISTENADDR);
|
|
|
- tt_int_op(ret, OP_EQ, 1);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(NULL, NULL, config_listen_address, "DNS", 0, NULL,
|
|
|
- 0, 0);
|
|
|
- tt_int_op(ret, OP_EQ, -1);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- slout = smartlist_new();
|
|
|
- ret = parse_port_config(slout, config_port3, config_listen_address, "DNS",
|
|
|
- 0, NULL, 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);
|
|
|
- tt_int_op(port_cfg->port, OP_EQ, CFG_AUTO_PORT);
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(slout, config_port4, config_listen_address, "DNS",
|
|
|
- 0, NULL, 0, 0);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
- tt_int_op(smartlist_len(slout), OP_EQ, 2);
|
|
|
- port_cfg = (port_cfg_t *)smartlist_get(slout, 1);
|
|
|
- tt_int_op(port_cfg->port, OP_EQ, 55542);
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(slout, config_port5, config_listen_address, "DNS",
|
|
|
- 0, NULL, 0, 0);
|
|
|
- tt_int_op(ret, OP_EQ, -1);
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(slout, NULL, config_listen_address, "DNS", 0, NULL,
|
|
|
- 123, CL_PORT_SERVER_OPTIONS);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
- tt_int_op(smartlist_len(slout), OP_EQ, 4);
|
|
|
- port_cfg = (port_cfg_t *)smartlist_get(slout, 2);
|
|
|
- tt_int_op(port_cfg->port, OP_EQ, 123);
|
|
|
- tt_int_op(port_cfg->server_cfg.no_listen, OP_EQ, 1);
|
|
|
- tt_int_op(port_cfg->server_cfg.bind_ipv4_only, OP_EQ, 1);
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(NULL, NULL, config_listen_address2, "DNS", 0, NULL,
|
|
|
- 222, 0);
|
|
|
- tt_int_op(ret, OP_EQ, -1);
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(slout, config_port2, config_listen_address3, "DNS",
|
|
|
- 0, NULL, 0, 0);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
- tt_int_op(smartlist_len(slout), OP_EQ, 5);
|
|
|
- port_cfg = (port_cfg_t *)smartlist_get(slout, 4);
|
|
|
- tt_int_op(port_cfg->port, OP_EQ, 1442);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(NULL, config_port2, config_listen_address, "DNS",
|
|
|
- 0, NULL, 0, 0);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(slout, config_port2, config_listen_address, "DNS",
|
|
|
- CONN_TYPE_CONTROL_LISTENER, NULL, 0,
|
|
|
- CL_PORT_WARN_NONLOCAL);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(slout, config_port2, config_listen_address, "DNS",
|
|
|
- CONN_TYPE_EXT_OR_LISTENER, NULL, 0,
|
|
|
- CL_PORT_WARN_NONLOCAL);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
-
|
|
|
-
|
|
|
- SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
- smartlist_clear(slout);
|
|
|
- ret = parse_port_config(slout, config_port2, config_listen_address, "DNS",
|
|
|
- 0, NULL, 0, CL_PORT_WARN_NONLOCAL);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
-
|
|
|
-
|
|
|
- ret = parse_port_config(NULL, config_port2, config_listen_address, "DNS",
|
|
|
- CONN_TYPE_CONTROL_LISTENER, NULL, 0,
|
|
|
- CL_PORT_WARN_NONLOCAL);
|
|
|
- tt_int_op(ret, OP_EQ, 0);
|
|
|
-
|
|
|
- done:
|
|
|
- config_free_lines(config_listen_address);
|
|
|
- config_free_lines(config_listen_address2);
|
|
|
- config_free_lines(config_listen_address3);
|
|
|
- config_free_lines(config_port1);
|
|
|
-
|
|
|
- config_free_lines(config_port3);
|
|
|
- config_free_lines(config_port4);
|
|
|
- config_free_lines(config_port5);
|
|
|
- if (slout)
|
|
|
- SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
- smartlist_free(slout);
|
|
|
-}
|
|
|
-
|
|
|
static void
|
|
|
test_config_parse_port_config__ports__no_ports_given(void *data)
|
|
|
{
|
|
@@ -4012,40 +3874,40 @@ test_config_parse_port_config__ports__no_ports_given(void *data)
|
|
|
slout = smartlist_new();
|
|
|
|
|
|
|
|
|
- ret = parse_port_config(NULL, NULL, NULL, "DNS", 0, NULL, 0, 0);
|
|
|
+ ret = parse_port_config(NULL, NULL, "DNS", 0, NULL, 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
|
|
|
|
|
|
- ret = parse_port_config(NULL, NULL, NULL, "DNS", 0, NULL, 42, 0);
|
|
|
+ ret = parse_port_config(NULL, NULL, "DNS", 0, NULL, 42, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
|
|
|
|
|
|
- ret = parse_port_config(NULL, NULL, NULL, "DNS", 0, "127.0.0.2", 0, 0);
|
|
|
+ ret = parse_port_config(NULL, NULL, "DNS", 0, "127.0.0.2", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
|
|
|
|
|
|
- ret = parse_port_config(NULL, NULL, NULL, "DNS", 0, "127.0.0.2", 42, 0);
|
|
|
+ ret = parse_port_config(NULL, NULL, "DNS", 0, "127.0.0.2", 42, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
|
|
|
|
|
|
- ret = parse_port_config(slout, NULL, NULL, "DNS", 0, NULL, 0, 0);
|
|
|
+ ret = parse_port_config(slout, NULL, "DNS", 0, NULL, 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 0);
|
|
|
|
|
|
|
|
|
- ret = parse_port_config(slout, NULL, NULL, "DNS", 0, NULL, 42, 0);
|
|
|
+ ret = parse_port_config(slout, NULL, "DNS", 0, NULL, 42, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 0);
|
|
|
|
|
|
|
|
|
- ret = parse_port_config(slout, NULL, NULL, "DNS", 0, "127.0.0.2", 0, 0);
|
|
|
+ ret = parse_port_config(slout, NULL, "DNS", 0, "127.0.0.2", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 0);
|
|
|
|
|
|
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
- ret = parse_port_config(slout, NULL, NULL, "DNS", 0, "127.0.0.2", 42, 0);
|
|
|
+ ret = parse_port_config(slout, NULL, "DNS", 0, "127.0.0.2", 42, 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);
|
|
@@ -4056,7 +3918,7 @@ test_config_parse_port_config__ports__no_ports_given(void *data)
|
|
|
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
- ret = parse_port_config(slout, NULL, NULL, "DNS", 0, "/foo/bar/unixdomain",
|
|
|
+ ret = parse_port_config(slout, NULL, "DNS", 0, "/foo/bar/unixdomain",
|
|
|
42, CL_PORT_IS_UNIXSOCKET);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4085,28 +3947,28 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
|
|
|
|
|
|
config_port_invalid = mock_config_line("DNSPort", "");
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0, NULL,
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "DNS", 0, NULL,
|
|
|
0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
|
|
|
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
|
|
config_port_invalid = mock_config_line("DNSPort", "unix:");
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0, NULL,
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "DNS", 0, NULL,
|
|
|
0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
|
|
|
|
|
|
|
config_port_valid = mock_config_line("DNSPort", "unix:/tmp/foo/bar");
|
|
|
- ret = parse_port_config(NULL, config_port_valid, NULL, "DNS",
|
|
|
+ ret = parse_port_config(NULL, config_port_valid, "DNS",
|
|
|
CONN_TYPE_AP_DNS_LISTENER, NULL, 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
|
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0, 0);
|
|
|
#ifdef _WIN32
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
@@ -4131,7 +3993,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
"unix:/tmp/foo/bar NoIPv4Traffic "
|
|
|
"NoIPv6Traffic "
|
|
|
"NoOnionTraffic");
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
@@ -4140,7 +4002,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
|
|
config_port_invalid = mock_config_line("DNSPort",
|
|
|
"127.0.0.1:80 NoDNSRequest");
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS",
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "DNS",
|
|
|
CONN_TYPE_AP_DNS_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
@@ -4153,7 +4015,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_port_valid = mock_config_line("DNSPort", "127.0.0.1:80 "
|
|
|
"NoIPv6Traffic "
|
|
|
"NoIPv4Traffic NoOnionTraffic");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS",
|
|
|
CONN_TYPE_AP_DNS_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
@@ -4169,7 +4031,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_port_invalid = mock_config_line("SOCKSPort",
|
|
|
"NoIPv6Traffic "
|
|
|
"unix:/tmp/foo/bar NoIPv4Traffic");
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
@@ -4182,7 +4044,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
|
|
|
"NoIPv6Traffic "
|
|
|
"NoDNSRequest NoIPv4Traffic");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
#ifdef _WIN32
|
|
@@ -4204,7 +4066,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_port_valid = mock_config_line("SOCKSPort", "unix:\"/tmp/foo/ bar\" "
|
|
|
"NoIPv6Traffic "
|
|
|
"NoDNSRequest NoIPv4Traffic");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
#ifdef _WIN32
|
|
@@ -4226,7 +4088,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_port_valid = mock_config_line("SOCKSPort", "unix:\"/tmp/foo/ bar "
|
|
|
"NoIPv6Traffic "
|
|
|
"NoDNSRequest NoIPv4Traffic");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
@@ -4238,7 +4100,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_port_valid = mock_config_line("SOCKSPort", "unix:\"\" "
|
|
|
"NoIPv6Traffic "
|
|
|
"NoDNSRequest NoIPv4Traffic");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
@@ -4249,7 +4111,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
|
|
|
"OnionTrafficOnly");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
#ifdef _WIN32
|
|
@@ -4270,7 +4132,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
|
|
|
"NoIPv4Traffic IPv6Traffic");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
#ifdef _WIN32
|
|
@@ -4289,7 +4151,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
|
|
|
"IPv4Traffic IPv6Traffic");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, NULL, 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
#ifdef _WIN32
|
|
@@ -4305,28 +4167,28 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
|
|
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
|
|
config_port_invalid = mock_config_line("DNSPort", "42 WorldWritable");
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
|
|
|
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
|
|
config_port_invalid = mock_config_line("DNSPort", "42 GroupWritable");
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
|
|
|
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
|
|
config_port_invalid = mock_config_line("DNSPort", "42 RelaxDirModeCheck");
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
|
|
|
|
config_free_lines(config_port_valid); config_port_valid = NULL;
|
|
|
config_port_valid = mock_config_line("DNSPort", "42");
|
|
|
- ret = parse_port_config(NULL, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(NULL, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
|
|
@@ -4335,7 +4197,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 IsolateDestPort");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4348,7 +4210,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 NoIsolateDestPorts");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4361,7 +4223,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 IsolateDestAddr");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4374,7 +4236,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 IsolateSOCKSAuth");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4387,7 +4249,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 IsolateClientProtocol");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4400,7 +4262,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 IsolateClientAddr");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4411,7 +4273,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
|
|
|
config_free_lines(config_port_valid); config_port_valid = NULL;
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 ThisOptionDoesntExist");
|
|
|
- ret = parse_port_config(NULL, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(NULL, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
|
|
@@ -4420,7 +4282,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 NoIsolateSOCKSAuth");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.3", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4433,7 +4295,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("SOCKSPort",
|
|
|
"42 IPv6Traffic PreferIPv6");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, "127.0.0.42", 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
@@ -4446,7 +4308,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 CacheIPv4DNS");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4459,7 +4321,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 CacheIPv6DNS");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4472,7 +4334,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 NoCacheIPv4DNS");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4485,7 +4347,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 CacheDNS");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, CL_PORT_TAKES_HOSTNAMES);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4498,7 +4360,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 UseIPv4Cache");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4511,7 +4373,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 UseIPv6Cache");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4524,7 +4386,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 UseDNSCache");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4537,7 +4399,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 NoPreferIPv6Automap");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4549,7 +4411,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 PreferSOCKSNoAuth");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4564,14 +4426,14 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_port_invalid = mock_config_line("DNSPort", "0");
|
|
|
config_port_valid = mock_config_line("DNSPort", "42");
|
|
|
config_port_invalid->next = config_port_valid;
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.42", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
|
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "Control",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "Control",
|
|
|
CONN_TYPE_CONTROL_LISTENER, "127.0.0.42", 0,
|
|
|
CL_PORT_WARN_NONLOCAL);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
@@ -4579,7 +4441,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "ExtOR",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "ExtOR",
|
|
|
CONN_TYPE_EXT_OR_LISTENER, "127.0.0.42", 0,
|
|
|
CL_PORT_WARN_NONLOCAL);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
@@ -4587,12 +4449,12 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, CL_PORT_WARN_NONLOCAL);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
|
|
|
|
|
|
- ret = parse_port_config(NULL, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(NULL, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.42", 0, CL_PORT_WARN_NONLOCAL);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
|
|
@@ -4603,7 +4465,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 IPv4Traffic "
|
|
|
"IPv6Traffic");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.44", 0,
|
|
|
CL_PORT_TAKES_HOSTNAMES |
|
|
|
CL_PORT_NO_STREAM_OPTIONS);
|
|
@@ -4618,7 +4480,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("DNSPort", "42 SessionGroup=invalid");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4630,7 +4492,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
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, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.44", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4640,7 +4502,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("DNSPort", "42 SessionGroup=123 "
|
|
|
"SessionGroup=321");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4649,7 +4511,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "42 SessionGroup=1111122");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4661,7 +4523,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "0");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.45", 0, CL_PORT_IS_UNIXSOCKET);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 0);
|
|
@@ -4671,7 +4533,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "something");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.45", 0, CL_PORT_IS_UNIXSOCKET);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4684,7 +4546,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "auto");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.46", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4698,7 +4560,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "127.0.0.122:auto");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.46", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4711,7 +4573,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
config_free_lines(config_port_invalid); config_port_invalid = NULL;
|
|
|
config_port_invalid = mock_config_line("DNSPort", "invalidstuff!!:auto");
|
|
|
MOCK(tor_addr_lookup, mock_tor_addr_lookup__fail_on_bad_addrs);
|
|
|
- ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(NULL, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.46", 0, 0);
|
|
|
UNMOCK(tor_addr_lookup);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
@@ -4721,7 +4583,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "127.0.0.123:656");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0,
|
|
|
"127.0.0.46", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4735,7 +4597,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("DNSPort", "something wrong");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.46", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4744,7 +4606,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("DNSPort", "127.0.1.0:123:auto");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
|
|
|
"127.0.0.46", 0, 0);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4754,7 +4616,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/somewhere");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "SOCKS",
|
|
|
CONN_TYPE_AP_LISTENER, "127.0.0.46", 0,
|
|
|
CL_PORT_DFLT_GROUP_WRITABLE);
|
|
|
#ifdef _WIN32
|
|
@@ -4789,7 +4651,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
config_free_lines(config_port_valid); config_port_valid = NULL;
|
|
|
config_port_valid = mock_config_line("DNSPort",
|
|
|
"127.0.0.124:656 NoAdvertise");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
|
|
|
CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4802,7 +4664,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "127.0.0.124:656 NoListen");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
|
|
|
CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4816,7 +4678,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("DNSPort", "127.0.0.124:656 NoListen "
|
|
|
"NoAdvertise");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0, NULL,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0, NULL,
|
|
|
0, CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4825,7 +4687,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "127.0.0.124:656 IPv4Only");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
|
|
|
CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4838,7 +4700,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "[::1]:656 IPv6Only");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
|
|
|
CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4852,7 +4714,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("DNSPort", "127.0.0.124:656 IPv6Only "
|
|
|
"IPv4Only");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0, NULL,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0, NULL,
|
|
|
0, CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4861,7 +4723,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_valid = mock_config_line("DNSPort", "127.0.0.124:656 unknown");
|
|
|
- ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
|
|
|
+ ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
|
|
|
CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, 0);
|
|
|
tt_int_op(smartlist_len(slout), OP_EQ, 1);
|
|
@@ -4872,7 +4734,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("DNSPort",
|
|
|
"127.0.0.124:656 IPv6Only");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0, NULL,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0, NULL,
|
|
|
0, CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4881,7 +4743,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("DNSPort", "[::1]:656 IPv4Only");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0, NULL,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "DNS", 0, NULL,
|
|
|
0, CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4890,7 +4752,7 @@ test_config_parse_port_config__ports__server_options(void *data)
|
|
|
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
|
|
|
smartlist_clear(slout);
|
|
|
config_port_invalid = mock_config_line("ORPort", "unix:\"\"");
|
|
|
- ret = parse_port_config(slout, config_port_invalid, NULL, "ORPort", 0, NULL,
|
|
|
+ ret = parse_port_config(slout, config_port_invalid, "ORPort", 0, NULL,
|
|
|
0, CL_PORT_SERVER_OPTIONS);
|
|
|
tt_int_op(ret, OP_EQ, -1);
|
|
|
|
|
@@ -4951,7 +4813,6 @@ struct testcase_t config_tests[] = {
|
|
|
CONFIG_TEST(fix_my_family, 0),
|
|
|
CONFIG_TEST(directory_fetch, 0),
|
|
|
CONFIG_TEST(port_cfg_line_extract_addrport, 0),
|
|
|
- CONFIG_TEST(parse_port_config__listenaddress, 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__ports_given, 0),
|