[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Fix SOCKS5 bug: Set replylen to 0 after sending hanshake back



Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv8916/src/or

Modified Files:
	connection_edge.c 
Log Message:
Fix SOCKS5 bug: Set replylen to 0 after sending hanshake back

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.305
retrieving revision 1.306
diff -u -d -r1.305 -r1.306
--- connection_edge.c	23 Mar 2005 08:40:10 -0000	1.305
+++ connection_edge.c	24 Mar 2005 01:11:28 -0000	1.306
@@ -840,6 +840,7 @@
   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 @@
     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;