diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-11-04 00:48:25 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-11-04 00:48:25 -0500 |
commit | 60c86a3b79d542543f191a78f5c7ea2c77c0d3f0 (patch) | |
tree | f24602f15430925d2449054d2f5fae025936d41c /src/test/test_socks.c | |
parent | 593909ea70db9c00d3ae6d3448fb096464e0853d (diff) | |
parent | 74cbd8d55953969c15c60f025889b1e07a185a79 (diff) | |
download | tor-60c86a3b79d542543f191a78f5c7ea2c77c0d3f0.tar.gz tor-60c86a3b79d542543f191a78f5c7ea2c77c0d3f0.zip |
Merge branch 'bug13315_squashed'
Conflicts:
src/or/buffers.c
Diffstat (limited to 'src/test/test_socks.c')
-rw-r--r-- | src/test/test_socks.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/test_socks.c b/src/test/test_socks.c index 5cc09e2006..29faa69fb8 100644 --- a/src/test/test_socks.c +++ b/src/test/test_socks.c @@ -229,6 +229,42 @@ test_socks_5_supported_commands(void *ptr) tt_int_op(0,==, buf_datalen(buf)); socks_request_clear(socks); + /* SOCKS 5 Should reject RESOLVE [F0] request for IPv4 address + * string if SafeSocks is enabled. */ + + ADD_DATA(buf, "\x05\x01\x00"); + ADD_DATA(buf, "\x05\xF0\x00\x03\x07"); + ADD_DATA(buf, "8.8.8.8"); + ADD_DATA(buf, "\x01\x02"); + tt_assert(fetch_from_buf_socks(buf,socks,get_options()->TestSocks,1) + == -1); + + tt_int_op(5,==,socks->socks_version); + tt_int_op(10,==,socks->replylen); + tt_int_op(5,==,socks->reply[0]); + tt_int_op(SOCKS5_NOT_ALLOWED,==,socks->reply[1]); + tt_int_op(1,==,socks->reply[3]); + + socks_request_clear(socks); + + /* SOCKS 5 should reject RESOLVE [F0] reject for IPv6 address + * string if SafeSocks is enabled. */ + + ADD_DATA(buf, "\x05\x01\x00"); + ADD_DATA(buf, "\x05\xF0\x00\x03\x27"); + ADD_DATA(buf, "2001:0db8:85a3:0000:0000:8a2e:0370:7334"); + ADD_DATA(buf, "\x01\x02"); + tt_assert(fetch_from_buf_socks(buf,socks,get_options()->TestSocks,1) + == -1); + + tt_int_op(5,==,socks->socks_version); + tt_int_op(10,==,socks->replylen); + tt_int_op(5,==,socks->reply[0]); + tt_int_op(SOCKS5_NOT_ALLOWED,==,socks->reply[1]); + tt_int_op(1,==,socks->reply[3]); + + socks_request_clear(socks); + /* SOCKS 5 Send RESOLVE_PTR [F1] for IP address 2.2.2.5 */ ADD_DATA(buf, "\x05\x01\x00"); ADD_DATA(buf, "\x05\xF1\x00\x01\x02\x02\x02\x05\x01\x03"); |