aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_socks.c
diff options
context:
space:
mode:
authorliberat <liberat@disroot.org>2019-11-11 15:35:21 +0000
committerliberat <liberat@disroot.org>2019-11-11 15:35:21 +0000
commitb7c74741303a528ac62f198e2c2c6a77745c2379 (patch)
treefa838e41689b7e7558030cc8a595b1cfe1070db0 /src/test/test_socks.c
parent4e4c4e72d74d66181bec537fc00a8af92be0a0af (diff)
downloadtor-b7c74741303a528ac62f198e2c2c6a77745c2379.tar.gz
tor-b7c74741303a528ac62f198e2c2c6a77745c2379.zip
Test case for SOCKS5 RESOLVE_PTR with binary IPv6 address.
This tests the handling of binary v6 addresses, which works correctly in older versions but was broken in 0.3.5.1-alpha.
Diffstat (limited to 'src/test/test_socks.c')
-rw-r--r--src/test/test_socks.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/test_socks.c b/src/test/test_socks.c
index 783f4726ee..dc24442589 100644
--- a/src/test/test_socks.c
+++ b/src/test/test_socks.c
@@ -399,6 +399,24 @@ 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 an IPv6 address */
+ ADD_DATA(buf, "\x05\x01\x00");
+ ADD_DATA(buf, "\x05\xF1\x00\x04"
+ "\x20\x01\x0d\xb8\x85\xa3\x00\x00\x00\x00\x8a\x2e\x03\x70\x73\x34"
+ "\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:
;
}