From d3ca6fe475ab5e0cc9c80e0ff984bebe4160f689 Mon Sep 17 00:00:00 2001 From: "teor (Tim Wilson-Brown)" Date: Fri, 1 Jul 2016 10:08:38 +1000 Subject: [PATCH] Call purpose_needs_anonymity in authority_certs_fetch_missing --- src/or/directory.c | 2 +- src/or/directory.h | 4 ++-- src/or/routerlist.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/or/directory.c b/src/or/directory.c index 1fe4d6804d..68ec3b7503 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -122,7 +122,7 @@ static void connection_dir_close_consensus_fetches( /** Return true iff the directory purpose dir_purpose (and if it's * fetching descriptors, it's fetching them for router_purpose) * must use an anonymous connection to a directory. */ -STATIC int +int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose) { if (get_options()->AllDirActionsPrivate) diff --git a/src/or/directory.h b/src/or/directory.h index afa3bcc611..f04e7ab315 100644 --- a/src/or/directory.h +++ b/src/or/directory.h @@ -132,12 +132,12 @@ int download_status_get_n_failures(const download_status_t *dls); int download_status_get_n_attempts(const download_status_t *dls); time_t download_status_get_next_attempt_at(const download_status_t *dls); +int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose); + #ifdef TOR_UNIT_TESTS /* Used only by directory.c and test_dir.c */ STATIC int parse_http_url(const char *headers, char **url); -STATIC int purpose_needs_anonymity(uint8_t dir_purpose, - uint8_t router_purpose); STATIC dirinfo_type_t dir_fetch_type(int dir_purpose, int router_purpose, const char *resource); STATIC int directory_handle_command_get(dir_connection_t *conn, diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 6ad276a913..cae0241343 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1076,8 +1076,8 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now, /* If we've just downloaded a consensus from a directory, re-use that * directory */ if (rs) { - /* Certificate fetches are one-hop, unless AllDirActionsPrivate is 1 */ - int get_via_tor = options->AllDirActionsPrivate; + int get_via_tor = purpose_needs_anonymity( + DIR_PURPOSE_FETCH_CERTIFICATE, 0); const dir_indirection_t indirection = get_via_tor ? DIRIND_ANONYMOUS : DIRIND_ONEHOP; directory_initiate_command_routerstatus(rs, @@ -1137,8 +1137,8 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now, /* If we've just downloaded a consensus from a directory, re-use that * directory */ if (rs) { - /* Certificate fetches are one-hop, unless AllDirActionsPrivate is 1 */ - int get_via_tor = options->AllDirActionsPrivate; + int get_via_tor = purpose_needs_anonymity( + DIR_PURPOSE_FETCH_CERTIFICATE, 0); const dir_indirection_t indirection = get_via_tor ? DIRIND_ANONYMOUS : DIRIND_ONEHOP; directory_initiate_command_routerstatus(rs,