commit 1fed3ff856194293775296256625cd3bd4064629 Author: George Kadianakis desnacked@gmail.com Date: Tue May 24 21:39:04 2011 +0200
Some last fixes and documentation improvements. --- src/socks.c | 4 ++-- src/socks.h | 5 +---- src/test/unittest_socks.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/socks.c b/src/socks.c index 367c2f1..7ee44ee 100644 --- a/src/socks.c +++ b/src/socks.c @@ -233,7 +233,7 @@ socks5_send_reply(struct evbuffer *reply_dest, socks_state_t *state, p[2] = 0; /* Reserved */
/* If status is SOCKS5_FAILED_UNSUPPORTED, it means that we failed - before populating state->parsereq. We will just feel the rest + before populating state->parsereq. We will just fill the rest of the reply packet with zeroes and ship it off. */ if (status == SOCKS5_FAILED_UNSUPPORTED) { @@ -241,7 +241,7 @@ socks5_send_reply(struct evbuffer *reply_dest, socks_state_t *state, p[3] = SOCKS5_ATYP_IPV4; memset(addr,'\x00',4); port = 0; - } else { + } else { /* state->parsereq is fine. move on. */ if (state->parsereq.af == AF_UNSPEC) { addrlen = 1; addr[0] = strlen(state->parsereq.addr); diff --git a/src/socks.h b/src/socks.h index 09ebe28..d360982 100644 --- a/src/socks.h +++ b/src/socks.h @@ -32,10 +32,7 @@ int socks5_send_reply(struct evbuffer *reply_dest, socks_state_t *state, int status);
-#define SOCKS_SUCCESS 0x0 -#define SOCKS_FAILED 0x01 - -#define SOCKS5_SUCCESS 0x0 +#define SOCKS5_SUCCESS 0x00 #define SOCKS5_FAILED_GENERAL 0x01 #define SOCKS5_FAILED_NOTALLOWED 0x02 #define SOCKS5_FAILED_NETUNREACH 0x03 diff --git a/src/test/unittest_socks.c b/src/test/unittest_socks.c index 8839eff..5ec28cc 100644 --- a/src/test/unittest_socks.c +++ b/src/test/unittest_socks.c @@ -269,7 +269,7 @@ test_socks_socks5_request(void *data) /* Eigth test: Everything is dreamy... if only the requested command was CONNECT... */ uchar req8[9]; - req8[0] = 3; + req8[0] = 2; /* BIND CMD */ req8[1] = 0; req8[2] = 1; memcpy(req8+3,&addr_ipv4,4); @@ -338,7 +338,7 @@ test_socks_socks5_request_reply(void *data) strcpy(state->parsereq.addr, "d:1:5:e:a:5:e:0");
tt_int_op(1, ==, socks5_send_reply(reply_dest, - state, SOCKS_SUCCESS)); + state, SOCKS5_SUCCESS));
uchar rep2[255]; evbuffer_remove(reply_dest,rep2,255);
tor-commits@lists.torproject.org