diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-01-03 10:11:23 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-01-03 10:17:00 -0500 |
commit | c4a6b56cc19878de4c76e83ce8e38ad709839d92 (patch) | |
tree | 8dcacd5e9b1bf64e412410fe22321ae0b2753756 /src/test/test_controller.c | |
parent | f23ec14d62f82ee424b7aef9ff1c2253c3dd2b10 (diff) | |
download | tor-c4a6b56cc19878de4c76e83ce8e38ad709839d92.tar.gz tor-c4a6b56cc19878de4c76e83ce8e38ad709839d92.zip |
Fix unit test failures in response to DNS hijacking.
Some DNS NXDOMAIN hijackers hijack truly ridiculous domains, like
"invalid-stuff!!" or "1.2.3.4.5". This would provoke unit test
failures where we used addresses like that to force
tor_addr_lookup() to fail. The fix, for testing, is to mock
tor_addr_lookup() with a variant that always fails when it gets
a name with a !.
Fixes bugs 20862 and 20863.
Diffstat (limited to 'src/test/test_controller.c')
-rw-r--r-- | src/test/test_controller.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/test_controller.c b/src/test/test_controller.c index 4e65d76662..d9c0a1eaac 100644 --- a/src/test/test_controller.c +++ b/src/test/test_controller.c @@ -10,6 +10,7 @@ #include "rendservice.h" #include "routerlist.h" #include "test.h" +#include "test_helpers.h" static void test_add_onion_helper_keyarg(void *arg) @@ -186,8 +187,10 @@ test_rend_service_parse_port_config(void *arg) tor_free(err_msg); /* bogus IP address */ - cfg = rend_service_parse_port_config("100 1.2.3.4.5:9000", + MOCK(tor_addr_lookup, mock_tor_addr_lookup__fail_on_bad_addrs); + cfg = rend_service_parse_port_config("100 foo!!.example.com:9000", " ", &err_msg); + UNMOCK(tor_addr_lookup); tt_assert(!cfg); tt_str_op(err_msg, OP_EQ, "Unparseable address in hidden service port " "configuration."); |