[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] check if we have a cached resolve for a tor-resolve address...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] check if we have a cached resolve for a tor-resolve address...
- From: arma@seul.org (Roger Dingledine)
- Date: Sun, 5 Dec 2004 07:47:48 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sun, 05 Dec 2004 07:48:10 -0500
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
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:
check if we have a cached resolve for a tor-resolve address *after*
we remove the .foo.exit part of the address.
Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.256
retrieving revision 1.257
diff -u -d -r1.256 -r1.257
--- connection_edge.c 5 Dec 2004 07:10:08 -0000 1.256
+++ connection_edge.c 5 Dec 2004 12:47:46 -0000 1.257
@@ -363,25 +363,6 @@
return sockshere;
} /* 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) {
- 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 (answer) {
- connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
- (char*)&answer);
- conn->has_sent_end = 1;
- connection_mark_for_close(conn);
- conn->hold_open_until_flushed = 1;
- return 0;
- }
- }
-
/* Parse the address provided by SOCKS. Modify it in-place if it
* specifies a hidden-service (.onion) or particular exit node (.exit).
*/
@@ -400,6 +381,26 @@
if (addresstype != ONION_HOSTNAME) {
/* not a hidden-service request (i.e. normal or .exit) */
+
+ if (socks->command == SOCKS_COMMAND_RESOLVE) {
+ uint32_t answer;
+ /* 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 (answer) {
+ connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
+ (char*)&answer);
+ conn->has_sent_end = 1;
+ connection_mark_for_close(conn);
+ conn->hold_open_until_flushed = 1;
+ return 0;
+ }
+ }
+
if (socks->command == SOCKS_COMMAND_CONNECT && socks->port == 0) {
log_fn(LOG_WARN,"Application asked to connect to port 0. Refusing.");
return -1;