From 0e51d5d274933e9e2ebd963a2fcf18890cbd41d7 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Thu, 12 Jan 2006 03:43:39 +0000 Subject: [PATCH] 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. svn:r5824 --- src/or/routerlist.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 0513495237..d9d636e707 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1523,23 +1523,27 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg, 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);