summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-03-24 01:11:28 +0000
committerNick Mathewson <nickm@torproject.org>2005-03-24 01:11:28 +0000
commit8e8915f3ca2e98e16abb62c7a32f86e4af6892d3 (patch)
treef576c385578a7bd93055318b9d6277a363601a28 /src
parent0cfdeb01c87b9958f0f6eee5c318213b9f4f32ac (diff)
downloadtor-8e8915f3ca2e98e16abb62c7a32f86e4af6892d3.tar.gz
tor-8e8915f3ca2e98e16abb62c7a32f86e4af6892d3.zip
Fix SOCKS5 bug: Set replylen to 0 after sending hanshake back
svn:r3850
Diffstat (limited to 'src')
-rw-r--r--src/or/connection_edge.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 12b4cb1b9b..019cdca023 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -840,6 +840,7 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
if (sockshere == 0) {
if (socks->replylen) {
connection_write_to_buf(socks->reply, socks->replylen, conn);
+ socks->replylen = 0; /* zero it out so we can do another round of negotiation */
} else {
log_fn(LOG_DEBUG,"socks handshake not all here yet.");
}
@@ -1238,8 +1239,7 @@ void connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
buf[1] = (status==SOCKS5_SUCCEEDED ? SOCKS4_GRANTED : SOCKS4_REJECT);
/* leave version, destport, destip zero */
connection_write_to_buf(buf, SOCKS4_NETWORK_LEN, conn);
- }
- if (conn->socks_request->socks_version == 5) {
+ } else if (conn->socks_request->socks_version == 5) {
buf[0] = 5; /* version 5 */
buf[1] = (char)status;
buf[2] = 0;