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
This commit is contained in:
Roger Dingledine 2006-01-12 03:43:39 +00:00
parent 38d32bc466
commit 0e51d5d274

View File

@ -1523,23 +1523,27 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
if (authdir) { if (authdir) {
if (authdir_wants_to_reject_router(router, msg, if (authdir_wants_to_reject_router(router, msg,
!from_cache && !from_fetch)) { !from_cache && !from_fetch)) {
tor_assert(*msg);
routerinfo_free(router); routerinfo_free(router);
return -2; return -2;
} }
authdir_verified = router->is_verified; authdir_verified = router->is_verified;
} else if (!from_cache) { } else if (from_fetch) {
/* Only check the descriptor digest against the network statuses when /* 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)) { if (!signed_desc_digest_is_recognized(&router->cache_info)) {
warn(LD_DIR, "Dropping unrecognized descriptor for router '%s'", warn(LD_DIR, "Dropping unrecognized descriptor for router '%s'",
router->nickname); router->nickname);
*msg = "Router descriptor is not referenced by any network-status.";
routerinfo_free(router); routerinfo_free(router);
return -1; return -1;
} }
} }
/* If we have a router with this name, and the identity key is the same, /* 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) { for (i = 0; i < smartlist_len(routerlist->routers); ++i) {
routerinfo_t *old_router = smartlist_get(routerlist->routers, i); routerinfo_t *old_router = smartlist_get(routerlist->routers, i);