[or-cvs] Special-case for retrieving own networkstatus by fingerprin...

Nick Mathewson nickm at seul.org
Thu Sep 8 19:29:24 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv14148/src/or

Modified Files:
	dirserv.c 
Log Message:
Special-case for retrieving own networkstatus by fingerprint: regenerate if dirty!

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- dirserv.c	8 Sep 2005 18:34:41 -0000	1.212
+++ dirserv.c	8 Sep 2005 19:29:21 -0000	1.213
@@ -1183,13 +1183,19 @@
       smartlist_add(result, val);
     }
   } else if (!strcmpstart(key, "fp/")) {
+    char own_fp[HEX_DIGEST_LEN+1];
+    crypto_pk_get_fingerprint(get_identity_key(), own_fp, 0);
     smartlist_t *hexdigests = smartlist_create();
     smartlist_split_string(hexdigests, key+3, "+", 0, 0);
     SMARTLIST_FOREACH(hexdigests, char *, cp,
         {
           cached_dir_t *cached;
           tor_strupper(cp);
-          /* XXXX special-case own key? */
+          if (!strcmp(cp, own_fp) &&
+              get_options()->AuthoritativeDir &&
+              the_v2_networkstatus_is_dirty &&
+              the_v2_networkstatus_is_dirty + DIR_REGEN_SLACK_TIME < time(NULL))
+            generate_v2_networkstatus();
           cached = strmap_get(cached_v2_networkstatus, cp);
           if (cached)
             smartlist_add(result, cached);



More information about the tor-commits mailing list