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

[or-cvs] don"t use cache for resolving .foo.exit names, but do reply...



Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or

Modified Files:
	connection_edge.c 
Log Message:
don't use cache for resolving .foo.exit names, but do reply immediately
if we're asked to resolve an IP.foo.exit.


Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -d -r1.258 -r1.259
--- connection_edge.c	6 Dec 2004 05:26:19 -0000	1.258
+++ connection_edge.c	6 Dec 2004 06:06:13 -0000	1.259
@@ -384,13 +384,17 @@
 
     if (socks->command == SOCKS_COMMAND_RESOLVE) {
       uint32_t answer;
+      struct in_addr in;
       /* Reply to resolves immediately if we can. */
       if (strlen(socks->address) > RELAY_PAYLOAD_SIZE) {
         log_fn(LOG_WARN,"Address to be resolved is too large. Failing.");
         connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_ERROR,0,NULL);
         return -1;
       }
-      answer = htonl(client_dns_lookup_entry(socks->address));
+      if (tor_inet_aton(socks->address, &in)) /* see if it's an IP already */
+        answer = ntohl(in.s_addr);
+      if (!answer && !conn->chosen_exit_name) /* if it's not .exit, check cache */
+        answer = htonl(client_dns_lookup_entry(socks->address));
       if (answer) {
         connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
                                                (char*)&answer);