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

[or-cvs] When the controller was submitting a descriptor, we were ch...



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

Modified Files:
	routerlist.c 
Log Message:
When the controller was submitting a descriptor, we were checking to make
sure some network-status we had referred to it, and refusing it if not.
This is bad for people who want to insert descriptors that aren't part of
the current Tor network. Now we accept them, and also give a more useful
warn message if we ask a dir mirror for a given descriptor and it gives us
one we weren't expecting.


Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.423
retrieving revision 1.424
diff -u -p -d -r1.423 -r1.424
--- routerlist.c	11 Jan 2006 03:58:07 -0000	1.423
+++ routerlist.c	12 Jan 2006 03:43:39 -0000	1.424
@@ -1523,23 +1523,27 @@ router_add_to_routerlist(routerinfo_t *r
   if (authdir) {
     if (authdir_wants_to_reject_router(router, msg,
                                        !from_cache && !from_fetch)) {
+      tor_assert(*msg);
       routerinfo_free(router);
       return -2;
     }
     authdir_verified = router->is_verified;
-  } else if (!from_cache) {
+  } else if (from_fetch) {
     /* Only check the descriptor digest against the network statuses when
-     * we are receiving from somewhere other than the cache. */
+     * we are receiving in response to a fetch. */
     if (!signed_desc_digest_is_recognized(&router->cache_info)) {
       warn(LD_DIR, "Dropping unrecognized descriptor for router '%s'",
            router->nickname);
+      *msg = "Router descriptor is not referenced by any network-status.";
       routerinfo_free(router);
       return -1;
     }
   }
 
   /* If we have a router with this name, and the identity key is the same,
-   * choose the newer one. If the identity key has changed, drop the router.
+   * choose the newer one. If the identity key has changed, and one of the
+   * routers is named, drop the unnamed ones. (If more than one are named,
+   * drop the old ones.)
    */
   for (i = 0; i < smartlist_len(routerlist->routers); ++i) {
     routerinfo_t *old_router = smartlist_get(routerlist->routers, i);