[or-cvs] reject tor-resolve requests for .onion addresses early

Roger Dingledine arma at seul.org
Sat Aug 7 00:19:16 UTC 2004


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

Modified Files:
	connection_edge.c 
Log Message:
reject tor-resolve requests for .onion addresses early


Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -d -r1.203 -r1.204
--- connection_edge.c	6 Aug 2004 10:13:25 -0000	1.203
+++ connection_edge.c	7 Aug 2004 00:19:14 -0000	1.204
@@ -401,11 +401,20 @@
     return connection_ap_handshake_attach_circuit(conn);
   } else {
     /* it's a hidden-service request */
-    /* XXX008 what does it mean to socks-resolve a hidden service? should
-     * we fail those right here? */
     rend_cache_entry_t *entry;
     int r;
 
+    if (socks->command == SOCKS_COMMAND_RESOLVE) {
+      /* if it's a resolve request, fail it right now, rather than
+       * building all the circuits and then realizing it won't work. */
+      connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_ERROR,0,NULL);
+      conn->socks_request->has_finished = 1;
+      conn->has_sent_end = 1;
+      connection_mark_for_close(conn);
+      conn->hold_open_until_flushed = 1;
+      return 0;
+    }
+
     strcpy(conn->rend_query, socks->address); /* this strcpy is safe -RD */
     log_fn(LOG_INFO,"Got a hidden service request for ID '%s'", conn->rend_query);
     /* see if we already have it cached */



More information about the tor-commits mailing list