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

[or-cvs] r17758: {tor} Use the literal parse of an address in dns_resolve_impl if p (tor/trunk/src/or)



Author: nickm
Date: 2008-12-23 21:38:07 -0500 (Tue, 23 Dec 2008)
New Revision: 17758

Modified:
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/dns.c
Log:
Use the literal parse of an address in dns_resolve_impl if parsing the address as an ipv4 or ipv6 address _succeeded_.  Not if it failed.  Bug introduced in r17707 (post 0.2.1.8-alpha), and found by xiando.

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2008-12-24 02:38:04 UTC (rev 17757)
+++ tor/trunk/src/or/connection_edge.c	2008-12-24 02:38:07 UTC (rev 17758)
@@ -2611,7 +2611,7 @@
   if (rh.command == RELAY_COMMAND_BEGIN_DIR) {
     tor_assert(or_circ);
     if (or_circ->p_conn && !tor_addr_is_null(&or_circ->p_conn->_base.addr))
-      n_stream->_base.addr = or_circ->p_conn->_base.addr;
+      tor_addr_assign(&n_stream->_base.addr, &or_circ->p_conn->_base.addr);
     return connection_exit_connect_dir(n_stream);
   }
 

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2008-12-24 02:38:04 UTC (rev 17757)
+++ tor/trunk/src/or/dns.c	2008-12-24 02:38:07 UTC (rev 17758)
@@ -616,7 +616,7 @@
 
   /* first check if exitconn->_base.address is an IP. If so, we already
    * know the answer. */
-  if (tor_addr_from_str(&addr, exitconn->_base.address)<0) {
+  if (tor_addr_from_str(&addr, exitconn->_base.address) >= 0) {
     tor_addr_assign(&exitconn->_base.addr, &addr);
     exitconn->address_ttl = DEFAULT_DNS_TTL;
     return 1;