[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Call purpose_needs_anonymity in authority_certs_fetch_missing



commit d3ca6fe475ab5e0cc9c80e0ff984bebe4160f689
Author: teor (Tim Wilson-Brown) <teor2345@xxxxxxxxx>
Date:   Fri Jul 1 10:08:38 2016 +1000

    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 1fe4d68..68ec3b7 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 <b>dir_purpose</b> (and if it's
  * fetching descriptors, it's fetching them for <b>router_purpose</b>)
  * 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 afa3bcc..f04e7ab 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 6ad276a..cae0241 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,



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits