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

[or-cvs] r8548: Resolve bug 336: When displaying circuit paths with non-name (in tor/trunk: . doc src/or)



Author: nickm
Date: 2006-09-29 23:11:13 -0400 (Fri, 29 Sep 2006)
New Revision: 8548

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/doc/TODO
   tor/trunk/src/or/circuitbuild.c
Log:
 r8800@totoro:  nickm | 2006-09-29 23:10:49 -0400
 Resolve bug 336: When displaying circuit paths with non-named routers, use their digests, not their nicknames.



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

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-09-30 00:10:21 UTC (rev 8547)
+++ tor/trunk/ChangeLog	2006-09-30 03:11:13 UTC (rev 8548)
@@ -45,6 +45,8 @@
     - Only include function names in log messages for debugging messages;
       in other cases, the content of the message should be clear on its own,
       and including the function name only seems to confuse users.
+    - Fix CIRC controller events so that controllers can learn the identity
+      digests of non-Named servers used in circuit paths. (Fixes bug 336.)
 
   o Security Fixes, minor:
     - If a client asked for a server by name, and we didn't have a

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2006-09-30 00:10:21 UTC (rev 8547)
+++ tor/trunk/doc/TODO	2006-09-30 03:11:13 UTC (rev 8548)
@@ -45,7 +45,8 @@
     - Specify and document
     - Implement
     - Note that we'd like a better speed-bump too.
-N - Bug 336: figure out the right thing to do when telling nicknames to
+  o Bug 336: CIRC events should have digests when appropriate.
+N - figure out the right thing to do when telling nicknames to
     controllers.  We should always give digest, and possibly sometimes give
     nickname? Or digest, and nickname, with indication of whether name is
     canonical?

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2006-09-30 00:10:21 UTC (rev 8547)
+++ tor/trunk/src/or/circuitbuild.c	2006-09-30 03:11:13 UTC (rev 8548)
@@ -116,20 +116,29 @@
                  circ->build_state->desired_path_len,
                  circ->_base.state == CIRCUIT_STATE_OPEN ? "" : ", exit ",
                  circ->_base.state == CIRCUIT_STATE_OPEN ? "" :
-                   (nickname?nickname:"*unnamed*"));
+                 (nickname?nickname:"*unnamed*"));
     smartlist_add(elements, tor_strdup(buf));
   }
 
   hop = circ->cpath;
   do {
-    const char *elt;
+    routerinfo_t *ri;
+    char *elt;
     if (!hop)
       break;
     if (!verbose && hop->state != CPATH_STATE_OPEN)
       break;
     if (!hop->extend_info)
       break;
-    elt = hop->extend_info->nickname;
+    if ((ri = router_get_by_digest(hop->extend_info->identity_digest)) &&
+        ri->is_named) {
+      elt = tor_strdup(hop->extend_info->nickname);
+    } else {
+      elt = tor_malloc(HEX_DIGEST_LEN+2);
+      elt[0] = '$';
+      base16_encode(elt+1, HEX_DIGEST_LEN+1,
+                    hop->extend_info->identity_digest, DIGEST_LEN);
+    }
     tor_assert(elt);
     if (verbose) {
       size_t len = strlen(elt)+2+strlen(states[hop->state])+1;
@@ -137,8 +146,9 @@
       tor_assert(hop->state <= 2);
       tor_snprintf(v,len,"%s(%s)",elt,states[hop->state]);
       smartlist_add(elements, v);
+      tor_free(elt);
     } else {
-      smartlist_add(elements, tor_strdup(elt));
+      smartlist_add(elements, elt);
     }
     hop = hop->next;
   } while (hop != circ->cpath);