Przeglądaj źródła

tweaks and bugfix on resolve/resolved code

svn:r1980
Roger Dingledine 21 lat temu
rodzic
commit
207fcb35d1
2 zmienionych plików z 3 dodań i 4 usunięć
  1. 0 3
      src/or/buffers.c
  2. 3 1
      src/or/connection_edge.c

+ 0 - 3
src/or/buffers.c

@@ -409,9 +409,6 @@ int fetch_from_buf_http(buf_t *buf,
   return 1;
   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
 /** There is a (possibly incomplete) socks handshake on <b>buf</b>, of one
  * of the forms
  * of the forms
  *  - socks4: "socksheader username\\0"
  *  - socks4: "socksheader username\\0"

+ 3 - 1
src/or/connection_edge.c

@@ -372,13 +372,15 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
   } /* else socks handshake is done, continue processing */
   } /* else socks handshake is done, continue processing */
 
 
   if (socks->command == SOCKS_COMMAND_RESOLVE) {
   if (socks->command == SOCKS_COMMAND_RESOLVE) {
+    uint32_t answer;
     /* Reply to resolves immediately if we can. */
     /* Reply to resolves immediately if we can. */
     if (strlen(socks->address) > RELAY_PAYLOAD_SIZE) {
     if (strlen(socks->address) > RELAY_PAYLOAD_SIZE) {
       connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_ERROR,0,NULL);
       connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_ERROR,0,NULL);
       conn->socks_request->has_finished = 1;
       conn->socks_request->has_finished = 1;
       connection_mark_for_close(conn);
       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) {
     if (answer) {
       connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
       connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
                                              (char*)&answer);
                                              (char*)&answer);