[or-cvs] Bugfix for trackhostexits: write down the fingerprint of th...

arma at seul.org arma at seul.org
Mon Dec 5 00:15:44 UTC 2005


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

Modified Files:
	circuituse.c 
Log Message:
Bugfix for trackhostexits: write down the fingerprint of the chosen exit,
not its nickname, because the chosen exit might not be verified.


Index: circuituse.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuituse.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- circuituse.c	4 Dec 2005 22:23:24 -0000	1.99
+++ circuituse.c	5 Dec 2005 00:15:42 -0000	1.100
@@ -1030,6 +1030,7 @@
   or_options_t *options = get_options();
   size_t len;
   char *new_address;
+  char fp[HEX_DIGEST_LEN+1];
 
   /* Search the addressmap for this conn's destination. */
   /* If he's not in the address map.. */
@@ -1054,16 +1055,19 @@
   if (!found_needle || !circ->build_state->chosen_exit)
     return;
 
+  /* write down the fingerprint of the chosen exit, not the nickname,
+   * because the chosen exit might not be verified. */
+  base16_encode(fp, sizeof(fp),
+                circ->build_state->chosen_exit->identity_digest, DIGEST_LEN);
+
   /* Add this exit/hostname pair to the addressmap. */
   len = strlen(conn->socks_request->address) + 1 /* '.' */ +
-        strlen(circ->build_state->chosen_exit->nickname) + 1 /* '.' */ +
+        strlen(fp) + 1 /* '.' */ +
         strlen("exit") + 1 /* '\0' */;
   new_address = tor_malloc(len);
 
-  //XXX need to use $key not nickname
   tor_snprintf(new_address, len, "%s.%s.exit",
-               conn->socks_request->address,
-               circ->build_state->chosen_exit->nickname);
+               conn->socks_request->address, fp);
 
   addressmap_register(conn->socks_request->address, new_address,
                       time(NULL) + options->TrackHostExitsExpire);



More information about the tor-commits mailing list