aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_socks.c
diff options
context:
space:
mode:
authorliberat <liberat@disroot.org>2019-11-11 15:41:56 +0000
committerliberat <liberat@disroot.org>2019-11-11 15:41:56 +0000
commit4ae77e15d0ac8c6449d2a6588a7ebfab887954c1 (patch)
treefb69654d8bdff94ec7a4cf58102ecfa0bbcac84f /src/test/test_socks.c
parentb7c74741303a528ac62f198e2c2c6a77745c2379 (diff)
downloadtor-4ae77e15d0ac8c6449d2a6588a7ebfab887954c1.tar.gz
tor-4ae77e15d0ac8c6449d2a6588a7ebfab887954c1.zip
Test case for SOCKS5 RESOLVE_PTR with IPv6 address in brackets.
This was not supported previously, but provides symmetry with other SOCKS requests, which also support addresses written in brackets.
Diffstat (limited to 'src/test/test_socks.c')
-rw-r--r--src/test/test_socks.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/test_socks.c b/src/test/test_socks.c
index dc24442589..76c2d50ae8 100644
--- a/src/test/test_socks.c
+++ b/src/test/test_socks.c
@@ -417,6 +417,25 @@ test_socks_5_supported_commands(void *ptr)
tt_int_op(0,OP_EQ, buf_datalen(buf));
+ socks_request_clear(socks);
+
+ /* SOCKS 5 Send RESOLVE_PTR [F1] for a an IPv6 address written as a
+ * string with brackets */
+ ADD_DATA(buf, "\x05\x01\x00");
+ ADD_DATA(buf, "\x05\xF1\x00\x03\x1e");
+ ADD_DATA(buf, "[2001:db8:85a3::8a2e:370:7334]");
+ ADD_DATA(buf, "\x12\x34");
+ tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
+ get_options()->SafeSocks),
+ OP_EQ, 1);
+ tt_int_op(5,OP_EQ, socks->socks_version);
+ tt_int_op(2,OP_EQ, socks->replylen);
+ tt_int_op(5,OP_EQ, socks->reply[0]);
+ tt_int_op(0,OP_EQ, socks->reply[1]);
+ tt_str_op("[2001:db8:85a3::8a2e:370:7334]",OP_EQ, socks->address);
+
+ tt_int_op(0,OP_EQ, buf_datalen(buf));
+
done:
;
}