]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
tweaks and bugfix on resolve/resolved code
authorRoger Dingledine <arma@torproject.org>
Thu, 17 Jun 2004 21:11:09 +0000 (21:11 +0000)
committerRoger Dingledine <arma@torproject.org>
Thu, 17 Jun 2004 21:11:09 +0000 (21:11 +0000)
svn:r1980

src/or/buffers.c
src/or/connection_edge.c

index 855443dd3f5a7c0f019ac16b74de5f55eea85333..407b5f5a1d4f5dd1f0ea59abf1f9eae4ed4f27df 100644 (file)
@@ -409,9 +409,6 @@ int fetch_from_buf_http(buf_t *buf,
   return 1;
 }
 
-#define SOCKS_COMMAND_CONNECT 0x01
-#define SOCKS_COMMAND_RESOLVE 0xF0
-
 /** There is a (possibly incomplete) socks handshake on <b>buf</b>, of one
  * of the forms
  *  - socks4: "socksheader username\\0"
index 20a9341a89920d1a2f402fc44174f3dba49abe33..15dbe9a28948d706bbead0ebcdda5957ca522831 100644 (file)
@@ -372,13 +372,15 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
   } /* else socks handshake is done, continue processing */
 
   if (socks->command == SOCKS_COMMAND_RESOLVE) {
+    uint32_t answer;
     /* Reply to resolves immediately if we can. */
     if (strlen(socks->address) > RELAY_PAYLOAD_SIZE) {
       connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_ERROR,0,NULL);
       conn->socks_request->has_finished = 1;
       connection_mark_for_close(conn);
+      return 0;
     }
-    uint32_t answer = htonl(client_dns_lookup_entry(socks->address));
+    answer = htonl(client_dns_lookup_entry(socks->address));
     if (answer) {
       connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
                                              (char*)&answer);