mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
r14770@Kushana: nickm | 2007-10-08 11:43:02 -0400
Make router_digest_is_trusted_dir able to check for type. When looking for a V3 directory, only assume that the V3 authorities and caches have it: previous code assumed that all authorities had it. svn:r11789
This commit is contained in:
parent
3f6e3ce61b
commit
84d7677a8a
3
doc/TODO
3
doc/TODO
@ -83,8 +83,9 @@ Things we'd like to do in 0.2.0.x:
|
||||
them
|
||||
o Download code
|
||||
o Code to schedule downloads
|
||||
- Code to retry fail downloads
|
||||
- Code to retry failed downloads
|
||||
- Code to delay next download while fetching certificates
|
||||
- Code to download routers listed in v3 networkstatus consensuses.
|
||||
- Enable for non-caches
|
||||
- Code to use v3 networkstatus documents once clients are
|
||||
fetching them
|
||||
|
@ -3495,7 +3495,10 @@ signed_descriptor_t *router_get_by_extrainfo_digest(const char *digest);
|
||||
signed_descriptor_t *extrainfo_get_by_descriptor_digest(const char *digest);
|
||||
const char *signed_descriptor_get_body(signed_descriptor_t *desc);
|
||||
int router_digest_version_as_new_as(const char *digest, const char *cutoff);
|
||||
int router_digest_is_trusted_dir(const char *digest);
|
||||
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)
|
||||
routerlist_t *router_get_routerlist(void);
|
||||
void routerlist_reset_warnings(void);
|
||||
void routerlist_free(routerlist_t *routerlist);
|
||||
|
@ -990,10 +990,13 @@ router_pick_directory_server_impl(int requireother, int fascistfirewall,
|
||||
continue;
|
||||
if (requireother && router_digest_is_me(status->identity_digest))
|
||||
continue;
|
||||
if (type & V3_AUTHORITY) {
|
||||
if (!(status->version_supports_v3_dir ||
|
||||
router_digest_is_trusted_dir_type(status->identity_digest,
|
||||
V3_AUTHORITY)))
|
||||
continue;
|
||||
}
|
||||
is_trusted = router_digest_is_trusted_dir(status->identity_digest);
|
||||
if ((type & V3_AUTHORITY &&
|
||||
!(status->version_supports_v3_dir || is_trusted)))
|
||||
continue; /* is_trusted is not quite right XXXX020. */
|
||||
if ((type & V2_AUTHORITY) && !(status->is_v2_dir || is_trusted))
|
||||
continue;
|
||||
if ((type & EXTRAINFO_CACHE) &&
|
||||
@ -1886,17 +1889,20 @@ router_digest_version_as_new_as(const char *digest, const char *cutoff)
|
||||
return tor_version_as_new_as(router->platform, cutoff);
|
||||
}
|
||||
|
||||
/** Return true iff <b>digest</b> is the digest of the identity key of
|
||||
* a trusted directory. */
|
||||
/** Return true iff <b>digest</b> is the digest of the identity key of a
|
||||
* trusted directory matching at least one bit of <b>type</b>. If <b>type</b>
|
||||
* is zero, any authority is okay. */
|
||||
int
|
||||
router_digest_is_trusted_dir(const char *digest)
|
||||
router_digest_is_trusted_dir_type(const char *digest, authority_type_t type)
|
||||
{
|
||||
if (!trusted_dir_servers)
|
||||
return 0;
|
||||
if (authdir_mode(get_options()) && router_digest_is_me(digest))
|
||||
return 1;
|
||||
SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ent,
|
||||
if (!memcmp(digest, ent->digest, DIGEST_LEN)) return 1);
|
||||
if (!memcmp(digest, ent->digest, DIGEST_LEN)) {
|
||||
return (!type) || ((type & ent->type) != 0);
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user