diff options
author | rl1987 <rl1987@sdf.lonestar.org> | 2015-10-10 18:03:11 +0300 |
---|---|---|
committer | rl1987 <rl1987@sdf.lonestar.org> | 2015-10-24 14:30:52 +0300 |
commit | 72bd192d80f8fed04c35f1a34b0e762562a41c48 (patch) | |
tree | ccfa6673f01a60734cce6d9bd59bec9b1b13cd1e /src/test/test_dns.c | |
parent | 787a27be3e27d11d873352a8eb14e068ed3fdad5 (diff) | |
download | tor-72bd192d80f8fed04c35f1a34b0e762562a41c48.tar.gz tor-72bd192d80f8fed04c35f1a34b0e762562a41c48.zip |
Add a fourth test case.
Diffstat (limited to 'src/test/test_dns.c')
-rw-r--r-- | src/test/test_dns.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/test/test_dns.c b/src/test/test_dns.c index aeabdf633f..510fec12a5 100644 --- a/src/test/test_dns.c +++ b/src/test/test_dns.c @@ -463,12 +463,49 @@ NS(test_main)(void *arg) #define NS_SUBMODULE ASPECT(resolve_impl, malformed_ptr) +/** Given that address is a malformed PTR name, we want dns_resolve_impl to + * fail. + */ + +static int +NS(router_my_exit_policy_is_reject_star)(void) +{ + return 0; +} + static void NS(test_main)(void *arg) { - tt_skip(); + int retval; + int made_pending; + + edge_connection_t *exitconn = create_valid_exitconn(); + or_circuit_t *on_circ = tor_malloc_zero(sizeof(or_circuit_t)); + + TO_CONN(exitconn)->address = tor_strdup("127.0.0.1.in-addr.arpa"); + + NS_MOCK(router_my_exit_policy_is_reject_star); + + retval = dns_resolve_impl(exitconn, 1, on_circ, NULL, &made_pending, + NULL); + + tt_int_op(retval,==,-1); + + tor_free(TO_CONN(exitconn)->address); + + TO_CONN(exitconn)->address = + tor_strdup("z01234567890123456789.in-addr.arpa"); + + retval = dns_resolve_impl(exitconn, 1, on_circ, NULL, &made_pending, + NULL); + + tt_int_op(retval,==,-1); done: + NS_UNMOCK(router_my_exit_policy_is_reject_star); + tor_free(TO_CONN(exitconn)->address); + tor_free(exitconn); + tor_free(on_circ); return; } |