get r11842 closer to what i want

svn:r11851
This commit is contained in:
Roger Dingledine 2007-10-10 20:13:52 +00:00
parent 976c8f8a71
commit d9a99b9ba6
3 changed files with 16 additions and 1 deletions

View File

@ -1852,7 +1852,7 @@ get_possible_sybil_list(const smartlist_t *routers)
last_addr = ri->addr;
addr_count = 1;
} else if (++addr_count > MAX_WITH_SAME_ADDR) {
if (!router_digest_is_trusted_dir(ri->cache_info.identity_digest) ||
if (!router_addr_is_trusted_dir(ri->addr) ||
addr_count > MAX_WITH_SAME_ADDR_ON_AUTHORITY)
digestmap_set(omit_as_sybil, ri->cache_info.identity_digest, ri);
}

View File

@ -3555,6 +3555,7 @@ int router_digest_is_trusted_dir_type(const char *digest,
authority_type_t type);
#define router_digest_is_trusted_dir(d) \
router_digest_is_trusted_dir_type((d), 0)
int router_addr_is_trusted_dir(uint32_t addr);
routerlist_t *router_get_routerlist(void);
void routerlist_reset_warnings(void);
void routerlist_free(routerlist_t *routerlist);

View File

@ -1783,6 +1783,20 @@ router_digest_is_trusted_dir_type(const char *digest, authority_type_t type)
return 0;
}
/** Return true iff <b>addr</b> is the address of one of our trusted
* directory authorities. */
int
router_addr_is_trusted_dir(uint32_t addr)
{
if (!trusted_dir_servers)
return 0;
SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ent,
if (ent->addr == addr)
return 1;
);
return 0;
}
/** If hexdigest is correctly formed, base16_decode it into
* digest, which must have DIGEST_LEN space in it.
* Return 0 on success, -1 on failure.