[or-cvs] r11805: Bugfixes in fetching certificates for a consensus: fetch tor (tor/trunk/src/or)

nickm at seul.org nickm at seul.org
Tue Oct 9 17:40:23 UTC 2007


Author: nickm
Date: 2007-10-09 13:40:23 -0400 (Tue, 09 Oct 2007)
New Revision: 11805

Modified:
   tor/trunk/src/or/dirvote.c
   tor/trunk/src/or/routerlist.c
Log:
Bugfixes in fetching certificates for a consensus: fetch tor/keys/fp/X, not tor/keys/X.  Also, count signatures where no certificate is known as "missing a certificate" not as "unknown authority."

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2007-10-09 17:40:00 UTC (rev 11804)
+++ tor/trunk/src/or/dirvote.c	2007-10-09 17:40:23 UTC (rev 11805)
@@ -725,11 +725,13 @@
         authority_cert_get_by_digests(voter->identity_digest,
                                       voter->signing_key_digest);
       if (! cert) {
-        if (!trusteddirserver_get_by_v3_auth_digest(voter->identity_digest))
+        if (!trusteddirserver_get_by_v3_auth_digest(voter->identity_digest)) {
           smartlist_add(unrecognized, voter);
-        else
+          ++n_unknown;
+        } else {
           smartlist_add(need_certs_from, voter);
-        ++n_unknown;
+          ++n_missing_key;
+        }
         continue;
       }
       if (networkstatus_check_voter_signature(consensus, voter, cert) < 0) {

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-10-09 17:40:00 UTC (rev 11804)
+++ tor/trunk/src/or/routerlist.c	2007-10-09 17:40:23 UTC (rev 11805)
@@ -318,12 +318,16 @@
 
   {
     smartlist_t *fps = smartlist_create();
+    smartlist_add(fps, tor_strdup("fp/"));
     SMARTLIST_FOREACH(missing_digests, const char *, d, {
-        char *fp = tor_malloc(HEX_DIGEST_LEN+1);
+        char *fp = tor_malloc(HEX_DIGEST_LEN+2);
         base16_encode(fp, HEX_DIGEST_LEN+1, d, DIGEST_LEN);
+        fp[HEX_DIGEST_LEN] = '+';
+        fp[HEX_DIGEST_LEN+1] = '\0';
         smartlist_add(fps, fp);
       });
-    resource = smartlist_join_strings(fps, "+", 0, NULL);
+    resource = smartlist_join_strings(fps, "", 0, NULL);
+    resource[strlen(resource)-1] = '\0';
     SMARTLIST_FOREACH(fps, char *, cp, tor_free(cp));
     smartlist_free(fps);
   }



More information about the tor-commits mailing list