Переглянути джерело

r13452@kushana: nickm | 2007-06-20 09:52:55 -0400
Patch from Robert Hogan: Generate STREAM NEW events for dnsport requests and tunneled directory connections. Log when we are testing for hijacking.


svn:r10737

Nick Mathewson 17 роки тому
батько
коміт
b5c8a6183a
4 змінених файлів з 10 додано та 3 видалено
  1. 3 1
      ChangeLog
  2. 2 0
      src/or/connection_edge.c
  3. 3 0
      src/or/dns.c
  4. 2 2
      src/or/dnsserv.c

+ 3 - 1
ChangeLog

@@ -19,10 +19,12 @@ Changes in version 0.2.0.3-alpha - 2007-??-??
   o Deprecated features:
     - RedirectExits is now deprecated.
 
-  o Minor feature (controller):
+  o Minor features (controller):
     - You can now use the ControlSocket option to tell Tor to listen for
       controller connections on Unix domain sockets on systems that support
       them.  (Patch from Peter Palfrader.)
+    - STREAM NEW events are generated for DNSPort requests and for tunneled
+      directory connections. (Patch from Robert Hogan.)
 
   o Minor bugfixes (directory):
     - Fix another crash bug related to extra-info caching.  (Bug found by

+ 2 - 0
src/or/connection_edge.c

@@ -1946,6 +1946,8 @@ connection_ap_make_link(char *address, uint16_t port,
 
   conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT;
 
+  control_event_stream_status(conn, STREAM_EVENT_NEW, 0);
+
   /* attaching to a dirty circuit is fine */
   if (connection_ap_handshake_attach_circuit(conn) < 0) {
     connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);

+ 3 - 0
src/or/dns.c

@@ -1407,6 +1407,9 @@ launch_wildcard_check(int min_len, int max_len, const char *suffix)
   name[len] = '\0';
   strlcat(name, suffix, sizeof(name));
 
+  log_info(LD_EXIT, "Testing whether our DNS server is hijacking nonexistent "
+           "domains with requrest for bogus hostname \"%s\"", name);
+
   addr = tor_strdup(name);
   r = evdns_resolve_ipv4(name, DNS_QUERY_NO_SEARCH,
                          evdns_wildcard_check_callback, addr);

+ 2 - 2
src/or/dnsserv.c

@@ -109,8 +109,6 @@ evdns_server_callback(struct evdns_server_request *req, void *_data)
     return;
   }
 
-  /* XXXX020 Send a stream event to the controller. */
-
   /* Make a new dummy AP connection, and attach the request to it. */
   conn = TO_EDGE_CONN(connection_new(CONN_TYPE_AP, AF_INET));
   conn->_base.state = AP_CONN_STATE_RESOLVE_WAIT;
@@ -131,6 +129,8 @@ evdns_server_callback(struct evdns_server_request *req, void *_data)
 
   connection_add(TO_CONN(conn));
 
+  control_event_stream_status(TO_CONN(conn), STREAM_EVENT_NEW, 0);
+
   /* Now, throw the connection over to get rewritten (which will answer it
   * immediately if it's in the cache, or completely bogus, or automapped),
   * and then attached to a circuit. */