diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-10-03 16:32:00 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-10-04 15:43:20 -0400 |
commit | 05aed5b635fa7148fe2a4ea87e7296fa6bec3087 (patch) | |
tree | f45449d1ee6666ed094cd0afed4f158099f2e31d /src/test/test_controller.c | |
parent | 684500519d5060fcbcc410a0e71d8d9a32fa8220 (diff) | |
download | tor-05aed5b635fa7148fe2a4ea87e7296fa6bec3087.tar.gz tor-05aed5b635fa7148fe2a4ea87e7296fa6bec3087.zip |
Allow a unix: address to contain a C-style quoted string.
Feature 18753 -- all this to allow spaces.
Diffstat (limited to 'src/test/test_controller.c')
-rw-r--r-- | src/test/test_controller.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/test/test_controller.c b/src/test/test_controller.c index 0dea8473b9..4ae35c8fe0 100644 --- a/src/test/test_controller.c +++ b/src/test/test_controller.c @@ -137,6 +137,8 @@ test_rend_service_parse_port_config(void *arg) cfg = rend_service_parse_port_config("80,[2001:db8::1]:8080", sep, &err_msg); tt_assert(cfg); tt_assert(!err_msg); + rend_service_port_config_free(cfg); + cfg = NULL; /* XXX: Someone should add tests for AF_UNIX targets if supported. */ @@ -151,6 +153,53 @@ test_rend_service_parse_port_config(void *arg) cfg = rend_service_parse_port_config("90001", sep, &err_msg); tt_assert(!cfg); tt_assert(err_msg); + tor_free(err_msg); + + /* unix port */ + cfg = NULL; + + /* quoted unix port */ + tor_free(err_msg); + cfg = rend_service_parse_port_config("100 unix:\"/tmp/foo bar\"", + " ", &err_msg); + tt_assert(cfg); + tt_assert(!err_msg); + rend_service_port_config_free(cfg); + cfg = NULL; + + /* quoted unix port */ + tor_free(err_msg); + cfg = rend_service_parse_port_config("100 unix:\"/tmp/foo bar\"", + " ", &err_msg); + tt_assert(cfg); + tt_assert(!err_msg); + rend_service_port_config_free(cfg); + cfg = NULL; + + /* quoted unix port, missing end quote */ + cfg = rend_service_parse_port_config("100 unix:\"/tmp/foo bar", + " ", &err_msg); + tt_assert(!cfg); + tt_str_op(err_msg, OP_EQ, "Couldn't process address <unix:\"/tmp/foo bar> " + "from hidden service configuration"); + tor_free(err_msg); + + /* bogus IP address */ + cfg = rend_service_parse_port_config("100 1.2.3.4.5:9000", + " ", &err_msg); + tt_assert(!cfg); + tt_str_op(err_msg, OP_EQ, "Unparseable address in hidden service port " + "configuration."); + tor_free(err_msg); + + /* bogus port port */ + cfg = rend_service_parse_port_config("100 99999", + " ", &err_msg); + tt_assert(!cfg); + tt_str_op(err_msg, OP_EQ, "Unparseable or out-of-range port \"99999\" " + "in hidden service port configuration."); + tor_free(err_msg); + done: rend_service_port_config_free(cfg); |