commit 9d2f727fe26a74cd2cb43c49bed107f4e60e752e Author: Zack Weinberg zackw@panix.com Date: Fri Jul 22 16:58:32 2011 -0700
whitespace and typos --- src/network.c | 4 ++-- src/socks.c | 10 +++++----- src/test/integration_test/int_test.sh | 4 ++-- src/test/unittest_socks.c | 30 +++++++++++++++--------------- 4 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/network.c b/src/network.c index 4a85478..7d05b91 100644 --- a/src/network.c +++ b/src/network.c @@ -399,8 +399,8 @@ plaintext_read_cb(struct bufferevent *bev, void *arg) }
/** - This callback is responsible for handling obfusacted - traffic -- traffic that has already been obfuscated + This callback is responsible for handling obfuscated + traffic -- traffic that has already been obfuscated by our protocol. */ static void diff --git a/src/socks.c b/src/socks.c index 333c787..f1eada4 100644 --- a/src/socks.c +++ b/src/socks.c @@ -106,14 +106,14 @@ socks_errno_to_reply(socks_state_t *state, int error) /** Takes a SOCKS5 command request from 'source', it evaluates it and if it's legit it parses it into 'parsereq'. - + It returns SOCKS_GOOD if everything went fine. It returns SOCKS_INCOMPLETE if we need more data from the client. It returns SOCKS_BROKEN if we didn't like something. It returns SOCKS_CMD_NOT_CONNECT if the client asked for something else other than CONNECT. If that's the case we should send a reply back to the client telling him that we don't support it. - + */ enum socks_ret socks5_handle_request(struct evbuffer *source, struct parsereq *parsereq) @@ -345,11 +345,11 @@ socks5_handle_negotiation(struct evbuffer *source, /** Takes a SOCKS4/SOCKS4a command request from 'source', it evaluates it and if it's legit it parses it into 'parsereq'. - + It returns SOCKS_GOOD if everything went fine. It returns SOCKS_INCOMPLETE if we need more data from the client. It returns SOCKS_BROKEN if we didn't like something. -*/ +*/
/* XXXX rename to socks4_handle_request or something. */ enum socks_ret @@ -552,7 +552,7 @@ socks_state_get_status(const socks_state_t *state) If we have previously parsed a SOCKS CONNECT request, this function places the corresponding address/port to 'af_out', 'addr_out' and 'port_out'. - + It returns 0 on success and -1 if it was called unnecessarily. */ int diff --git a/src/test/integration_test/int_test.sh b/src/test/integration_test/int_test.sh index d97a7f7..9aa37ac 100644 --- a/src/test/integration_test/int_test.sh +++ b/src/test/integration_test/int_test.sh @@ -36,7 +36,7 @@ sleep 2 if cmp -s alpha $FILE1 then echo "GREAT SUCCESS 1!" ; rm $FILE1 else echo "GREAT FAIL 1!" -fi +fi
kill -9 $ncat1_pid kill -9 $obfsproxy_pid @@ -66,7 +66,7 @@ sleep 2 if cmp -s alpha $FILE2 then echo "GREAT SUCCESS 2!" ; rm $FILE2 else echo "GREAT FAIL 2!" -fi +fi
kill -9 $ncat1_pid kill -9 $obfsproxy_pid diff --git a/src/test/unittest_socks.c b/src/test/unittest_socks.c index c6039af..d213a80 100644 --- a/src/test/unittest_socks.c +++ b/src/test/unittest_socks.c @@ -299,7 +299,7 @@ test_socks_socks5_request(void *data)
evbuffer_add(s->source, "\x05", 1); evbuffer_add(s->source, req8, 9); - /* '-2' means that we don't support the requested command. */ + /* '-2' means that we don't support the requested command. */ tt_int_op(SOCKS_CMD_NOT_CONNECT, ==, socks5_handle_request(s->source,&pr1));
end:; @@ -340,16 +340,16 @@ test_socks_socks5_request_reply(void *data) tt_int_op(0, ==, evbuffer_drain(s->dest, buffer_len));
/* Second test: - We ask the server to send us a reply on an IPv6 request with + We ask the server to send us a reply on an IPv6 request with succesful status. */ s->state->parsereq.af = AF_INET6; strcpy(s->state->parsereq.addr, "d:1:5:e:a:5:e:0"); - + socks5_send_reply(s->dest,s->state, SOCKS5_SUCCESS);
uchar rep2[255]; evbuffer_remove(s->dest,rep2,255); - + tt_assert(rep2[3] = SOCKS5_ATYP_IPV6); /* Test returned address against inet_pton(d:1:5:e:a:5:e:0) */ tt_mem_op(rep2+4, ==, @@ -381,11 +381,11 @@ test_socks_socks5_request_reply(void *data) /* check port */ tt_mem_op(rep3+5+strlen(fqdn), ==, "\x1c\xbd",2);
- /* Fourth test: + /* Fourth test: We ask the server while having an empty parsereq and with a - SOCKS5_FAILED_UNSUPPORTED status. */ + SOCKS5_FAILED_UNSUPPORTED status. */ memset(&s->state->parsereq,'\x00',sizeof(struct parsereq)); - + socks5_send_reply(s->dest,s->state, SOCKS5_FAILED_UNSUPPORTED); uchar rep4[255]; evbuffer_remove(s->dest,rep4,255); @@ -393,13 +393,13 @@ test_socks_socks5_request_reply(void *data) tt_assert(rep4[3] == SOCKS5_ATYP_IPV4); tt_mem_op(rep4+4, ==, "\x00\x00\x00\x00",4); tt_mem_op(rep4+4+4, ==, "\x00\x00", 2); - + end:; }
/** This function tests the 'Server reply' phase of the SOCKS4 - *and* SOCKS4a protocol. + *and* SOCKS4a protocol. It sends broken client request packets and it verifies that the SOCKS server detected the errors. It also sends some correct packets and it expects the server to like them. @@ -440,7 +440,7 @@ test_socks_socks4_request(void *data) memcpy(req2+1,&port,2); memcpy(req2+3,&addr,4); strcpy(req2+7,"KO"); - + evbuffer_add(s->source,req2,9);
tt_int_op(SOCKS_INCOMPLETE, ==, socks4_read_request(s->source,s->state)); @@ -448,7 +448,7 @@ test_socks_socks4_request(void *data) /* emptying source buffer before next test */ buffer_len = evbuffer_get_length(s->source); tt_int_op(0, ==, evbuffer_drain(s->source, buffer_len)); - + /* Third test: Correct SOCKS4 req packet with optional field. */ char req3[16]; @@ -476,7 +476,7 @@ test_socks_socks4_request(void *data) memcpy(req4+3,&addr_4a,4); strcpy(req4+7,"iamalive"); strcpy(req4+16, "www.test.example"); - + evbuffer_add(s->source,req4,33);
tt_int_op(SOCKS_GOOD, ==, socks4_read_request(s->source,s->state)); @@ -495,7 +495,7 @@ test_socks_socks4_request(void *data) memcpy(req5+3,&addr_4a,4); strcpy(req5+7,"iamalive"); strcpy(req5+16, "www.test.example"); - + /* Don't send it all. */ evbuffer_add(s->source,req5,28);
@@ -516,7 +516,7 @@ test_socks_socks4_request(void *data) strcpy(req6+7,"iamalive"); memset(req6+16,'2', HUGE); req6[16+HUGE] = '\x00'; - + evbuffer_add(s->source,req6,16+HUGE+1);
tt_int_op(SOCKS_BROKEN, ==, socks4_read_request(s->source,s->state)); @@ -545,7 +545,7 @@ test_socks_socks4_request_reply(void *data) We ask the server to send us a reply on an IPv4 request with succesful status. */ socks4_send_reply(s->dest,s->state, SOCKS4_SUCCESS); - + uchar rep1[255]; evbuffer_remove(s->dest,rep1,255); /* yes, this is dirty */