summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-06-15 11:33:40 -0400
committerNick Mathewson <nickm@torproject.org>2011-06-15 11:33:40 -0400
commita857f61e278aa5e5980722f9d458424b8790e9b1 (patch)
treedcbc2c65fa2b11990ddfbee8a8eee2d32043cea9 /src/or/directory.c
parent875a551409c81fced826336a73cafa36396a43f8 (diff)
parent44eafa9697b0adebfa5e18579adcf70cd6d9c935 (diff)
downloadtor-a857f61e278aa5e5980722f9d458424b8790e9b1.tar.gz
tor-a857f61e278aa5e5980722f9d458424b8790e9b1.zip
Merge remote-tracking branch 'rransom-tor/bug3332-v2'
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 5d63a540e8..7ded115274 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -858,6 +858,20 @@ directory_initiate_command(const char *address, const tor_addr_t *_addr,
if_modified_since, NULL);
}
+/** Return non-zero iff a directory connection with purpose
+ * <b>dir_purpose</b> reveals sensitive information about a Tor
+ * instance's client activities. (Such connections must be performed
+ * through normal three-hop Tor circuits.) */
+static int
+is_sensitive_dir_purpose(uint8_t dir_purpose)
+{
+ return ((dir_purpose == DIR_PURPOSE_FETCH_RENDDESC) ||
+ (dir_purpose == DIR_PURPOSE_HAS_FETCHED_RENDDESC) ||
+ (dir_purpose == DIR_PURPOSE_UPLOAD_RENDDESC) ||
+ (dir_purpose == DIR_PURPOSE_UPLOAD_RENDDESC_V2) ||
+ (dir_purpose == DIR_PURPOSE_FETCH_RENDDESC_V2));
+}
+
/** Same as directory_initiate_command(), but accepts rendezvous data to
* fetch a hidden service descriptor. */
static void
@@ -892,6 +906,9 @@ directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
log_debug(LD_DIR, "Initiating %s", dir_conn_purpose_to_string(dir_purpose));
+ tor_assert(!(is_sensitive_dir_purpose(dir_purpose) &&
+ !anonymized_connection));
+
/* ensure that we don't make direct connections when a SOCKS server is
* configured. */
if (!anonymized_connection && !use_begindir && !options->HTTPProxy &&