diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-03-27 15:31:29 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-27 15:31:29 -0400 |
commit | 9c0a1adfa21f12e6682fa26d43fbf91bab4e6fc3 (patch) | |
tree | 4854edff8e71379627e00cd23c8e3e0db63abc6e /src/test/test_addr.c | |
parent | a83abcf5ee5cb8fe245bc97e089e082f62921194 (diff) | |
download | tor-9c0a1adfa21f12e6682fa26d43fbf91bab4e6fc3.tar.gz tor-9c0a1adfa21f12e6682fa26d43fbf91bab4e6fc3.zip |
Don't do a DNS lookup on a bridge line address
Fixes bug 10801; bugfix on 07bf274d in 0.2.0.1-alpha.
Diffstat (limited to 'src/test/test_addr.c')
-rw-r--r-- | src/test/test_addr.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/test/test_addr.c b/src/test/test_addr.c index fec85a4696..5452ee9070 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -735,7 +735,7 @@ test_addr_parse(void) /* Correct call. */ r= tor_addr_port_parse(LOG_DEBUG, "192.0.2.1:1234", - &addr, &port); + &addr, &port, -1); test_assert(r == 0); tor_addr_to_str(buf, &addr, sizeof(buf), 0); test_streq(buf, "192.0.2.1"); @@ -744,31 +744,45 @@ test_addr_parse(void) /* Domain name. */ r= tor_addr_port_parse(LOG_DEBUG, "torproject.org:1234", - &addr, &port); + &addr, &port, -1); test_assert(r == -1); /* Only IP. */ r= tor_addr_port_parse(LOG_DEBUG, "192.0.2.2", - &addr, &port); + &addr, &port, -1); test_assert(r == -1); + r= tor_addr_port_parse(LOG_DEBUG, + "192.0.2.2", + &addr, &port, 200); + test_assert(r == 0); + tt_int_op(port,==,200); + /* Bad port. */ r= tor_addr_port_parse(LOG_DEBUG, "192.0.2.2:66666", - &addr, &port); + &addr, &port, -1); + test_assert(r == -1); + r= tor_addr_port_parse(LOG_DEBUG, + "192.0.2.2:66666", + &addr, &port, 200); test_assert(r == -1); /* Only domain name */ r= tor_addr_port_parse(LOG_DEBUG, "torproject.org", - &addr, &port); + &addr, &port, -1); + test_assert(r == -1); + r= tor_addr_port_parse(LOG_DEBUG, + "torproject.org", + &addr, &port, 200); test_assert(r == -1); /* Bad IP address */ r= tor_addr_port_parse(LOG_DEBUG, "192.0.2:1234", - &addr, &port); + &addr, &port, -1); test_assert(r == -1); done: |