summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2014-09-21 19:17:44 +0300
committerNick Mathewson <nickm@torproject.org>2014-09-29 09:14:42 -0400
commitc5ad890904b68596d1081ce92307f57e67a5e3e4 (patch)
tree9908c6a2e1ae43d55b3c9d9fd89028717be44081 /src/test
parente170205cd8aae085687ca3b166bcc38b2134fc22 (diff)
downloadtor-c5ad890904b68596d1081ce92307f57e67a5e3e4.tar.gz
tor-c5ad890904b68596d1081ce92307f57e67a5e3e4.zip
Respond with 'Command not supported' SOCKS5 reply message upon reception of unsupported request.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_socks.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/test/test_socks.c b/src/test/test_socks.c
index 20f58ca92a..2b8f824b50 100644
--- a/src/test/test_socks.c
+++ b/src/test/test_socks.c
@@ -143,23 +143,33 @@ test_socks_5_unsupported_commands(void *ptr)
ADD_DATA(buf, "\x05\x02\x00\x01\x02\x02\x02\x01\x01\x01");
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
get_options()->SafeSocks),==, -1);
- /* XXX: shouldn't tor reply 'command not supported' [07]? */
+
+ tt_int_op(5,==,socks->socks_version);
+ tt_int_op(10,==,socks->replylen);
+ tt_int_op(5,==,socks->reply[0]);
+ tt_int_op(SOCKS5_COMMAND_NOT_SUPPORTED,==,socks->reply[1]);
+ tt_int_op(1,==,socks->reply[3]);
buf_clear(buf);
socks_request_clear(socks);
/* SOCKS 5 Send unsupported UDP_ASSOCIATE [03] command */
- ADD_DATA(buf, "\x05\x03\x00\x01\x02");
+ ADD_DATA(buf, "\x05\x02\x00\x01");
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
get_options()->SafeSocks),==, 0);
tt_int_op(5,==, socks->socks_version);
tt_int_op(2,==, socks->replylen);
tt_int_op(5,==, socks->reply[0]);
- tt_int_op(2,==, socks->reply[1]);
+ tt_int_op(0,==, socks->reply[1]);
ADD_DATA(buf, "\x05\x03\x00\x01\x02\x02\x02\x01\x01\x01");
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
get_options()->SafeSocks),==, -1);
- /* XXX: shouldn't tor reply 'command not supported' [07]? */
+
+ tt_int_op(5,==,socks->socks_version);
+ tt_int_op(10,==,socks->replylen);
+ tt_int_op(5,==,socks->reply[0]);
+ tt_int_op(SOCKS5_COMMAND_NOT_SUPPORTED,==,socks->reply[1]);
+ tt_int_op(1,==,socks->reply[3]);
done:
;