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

[or-cvs] r10329: The second time that we resolve a.com and get 1.2.3.4, retur (in tor/trunk: . src/or)



Author: nickm
Date: 2007-05-25 14:22:43 -0400 (Fri, 25 May 2007)
New Revision: 10329

Modified:
   tor/trunk/
   tor/trunk/src/or/connection_edge.c
Log:
 r12959@catbus:  nickm | 2007-05-25 14:22:33 -0400
 The second time that we resolve a.com and get 1.2.3.4, return an A record mapping (a->1.2.3.4), not mapping (1.2.3.4->1.2.3.4).



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r12959] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2007-05-25 18:22:42 UTC (rev 10328)
+++ tor/trunk/src/or/connection_edge.c	2007-05-25 18:22:43 UTC (rev 10329)
@@ -1180,8 +1180,10 @@
   or_options_t *options = get_options();
   struct in_addr addr_tmp;
   int automap = 0;
+  char orig_address[MAX_SOCKS_ADDR_LEN];
 
   tor_strlower(socks->address); /* normalize it */
+  strlcpy(orig_address, socks->address, sizeof(orig_address));
   log_debug(LD_APP,"Client asked for %s:%d",
             safe_str(socks->address),
             socks->port);
@@ -1310,7 +1312,10 @@
         return -1;
       }
       if (tor_inet_aton(socks->address, &in)) { /* see if it's an IP already */
-        answer = in.s_addr; /* leave it in network order */
+        /* leave it in network order */
+        answer = in.s_addr;
+        /* remember _what_ is supposed to have been resolved. */
+        strlcpy(socks->address, orig_address, sizeof(socks->address));
         connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
                                                (char*)&answer,-1);
         connection_mark_unattached_ap(conn,