[or-cvs] r8588: Implement ORCONN with verbose names. (in tor/trunk: . doc src/or)

nickm at seul.org nickm at seul.org
Tue Oct 3 18:59:52 UTC 2006


Author: nickm
Date: 2006-10-03 14:59:52 -0400 (Tue, 03 Oct 2006)
New Revision: 8588

Modified:
   tor/trunk/
   tor/trunk/doc/TODO
   tor/trunk/src/or/control.c
Log:
 r8857 at totoro:  nickm | 2006-10-03 13:54:21 -0400
 Implement ORCONN with verbose names.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/branches/verbose-nicknames [r8857] on 96637b51-b116-0410-a10e-9941ebb49b64

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2006-10-03 18:59:48 UTC (rev 8587)
+++ tor/trunk/doc/TODO	2006-10-03 18:59:52 UTC (rev 8588)
@@ -55,7 +55,8 @@
       server with digest D named N".  Nothing else matches.)
     o Add ability to selectively send 'long' nicknames on v1 connections.
     o Add a feature to actually turn on the switch.
-    - Implement response for ORCONN.
+    o Implement response for ORCONN.
+    - As used in responses to getinfo requests?
     . Verify that everything actually does the right thing.
     - Specify everything.
 
@@ -131,6 +132,9 @@
     o Option to deal with broken DNS of the "ggoogle.com? Ah, you meant
       ads.me.com!" variety.
       o Autodetect whether DNS is broken in this way.
+      - Additional fix: allow clients to have some addresses that mean,
+        notfound.  Yes, this blacklists IPs for having ever been used by
+        DNS hijackers.
     o Don't ask reject *:* nodes for DNS unless client wants you to.
     . Asynchronous DNS
       o Document and rename SearchDomains, ResolvConf options

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2006-10-03 18:59:48 UTC (rev 8587)
+++ tor/trunk/src/or/control.c	2006-10-03 18:59:52 UTC (rev 8588)
@@ -2323,7 +2323,7 @@
   SMARTLIST_FOREACH(args, const char *, arg, {
       if (!strcasecmp(arg, "VERBOSE_NAMES"))
         verbose_names = 1;
-      if (!strcasecmp(arg, "EXTENDED_EVENTS"))
+      else if (!strcasecmp(arg, "EXTENDED_EVENTS"))
         extended_events = 1;
       else {
         connection_printf_to_buf(conn, "552 Unrecognized feature \"%s\"\r\n",
@@ -2882,11 +2882,6 @@
   if (EVENT_IS_INTERESTING1(EVENT_OR_CONN_STATUS)) {
     const char *status;
     char name[128];
-    if (conn->nickname)
-      strlcpy(name, conn->nickname, sizeof(name));
-    else
-      tor_snprintf(name, sizeof(name), "%s:%d",
-                   conn->_base.address, conn->_base.port);
     switch (tp)
       {
       case OR_CONN_EVENT_LAUNCHED: status = "LAUNCHED"; break;
@@ -2898,9 +2893,32 @@
         log_warn(LD_BUG, "Unrecognized status code %d", (int)tp);
         return 0;
       }
-    send_control1_event(EVENT_OR_CONN_STATUS, ALL_NAMES/*XXXX NM*/,
-                        "650 ORCONN %s %s\r\n",
-                        name, status);
+    if (EVENT_IS_INTERESTING1S(EVENT_OR_CONN_STATUS)) {
+      if (conn->nickname)
+        strlcpy(name, conn->nickname, sizeof(name));
+      else
+        tor_snprintf(name, sizeof(name), "%s:%d",
+                     conn->_base.address, conn->_base.port);
+      send_control1_event(EVENT_OR_CONN_STATUS, SHORT_NAMES,
+                          "650 ORCONN %s %s\r\n",
+                          name, status);
+    }
+    if (EVENT_IS_INTERESTING1L(EVENT_OR_CONN_STATUS)) {
+      routerinfo_t *ri = router_get_by_digest(conn->identity_digest);
+      if (ri) {
+        router_get_verbose_nickname(name, ri);
+      } else if (! tor_digest_is_zero(conn->identity_digest)) {
+        name[0] = '$';
+        base16_encode(name+1, sizeof(name)-1, conn->identity_digest,
+                      DIGEST_LEN);
+      } else {
+        tor_snprintf(name, sizeof(name), "%s:%d",
+                     conn->_base.address, conn->_base.port);
+      }
+      send_control1_event(EVENT_OR_CONN_STATUS, LONG_NAMES,
+                          "650 ORCONN %s %s\r\n",
+                          name, status);
+    }
   }
   return 0;
 }



More information about the tor-commits mailing list