mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +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
|
them
|
||||||
o Download code
|
o Download code
|
||||||
o Code to schedule downloads
|
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 delay next download while fetching certificates
|
||||||
|
- Code to download routers listed in v3 networkstatus consensuses.
|
||||||
- Enable for non-caches
|
- Enable for non-caches
|
||||||
- Code to use v3 networkstatus documents once clients are
|
- Code to use v3 networkstatus documents once clients are
|
||||||
fetching them
|
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);
|
signed_descriptor_t *extrainfo_get_by_descriptor_digest(const char *digest);
|
||||||
const char *signed_descriptor_get_body(signed_descriptor_t *desc);
|
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_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);
|
routerlist_t *router_get_routerlist(void);
|
||||||
void routerlist_reset_warnings(void);
|
void routerlist_reset_warnings(void);
|
||||||
void routerlist_free(routerlist_t *routerlist);
|
void routerlist_free(routerlist_t *routerlist);
|
||||||
|
@ -990,10 +990,13 @@ router_pick_directory_server_impl(int requireother, int fascistfirewall,
|
|||||||
continue;
|
continue;
|
||||||
if (requireother && router_digest_is_me(status->identity_digest))
|
if (requireother && router_digest_is_me(status->identity_digest))
|
||||||
continue;
|
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);
|
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))
|
if ((type & V2_AUTHORITY) && !(status->is_v2_dir || is_trusted))
|
||||||
continue;
|
continue;
|
||||||
if ((type & EXTRAINFO_CACHE) &&
|
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 tor_version_as_new_as(router->platform, cutoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return true iff <b>digest</b> is the digest of the identity key of
|
/** Return true iff <b>digest</b> is the digest of the identity key of a
|
||||||
* a trusted directory. */
|
* trusted directory matching at least one bit of <b>type</b>. If <b>type</b>
|
||||||
|
* is zero, any authority is okay. */
|
||||||
int
|
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)
|
if (!trusted_dir_servers)
|
||||||
return 0;
|
return 0;
|
||||||
if (authdir_mode(get_options()) && router_digest_is_me(digest))
|
if (authdir_mode(get_options()) && router_digest_is_me(digest))
|
||||||
return 1;
|
return 1;
|
||||||
SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ent,
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user