summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-02-19 09:09:25 -0500
committerNick Mathewson <nickm@torproject.org>2015-02-19 09:09:25 -0500
commit86105a4009bf3e128abfa3e735d8fa6f1f4d5975 (patch)
treeaed21bc05c8d864f30ec5460f013f9c80ea8b1a6
parent0e22da1b8de0bc10ebe80eb00f9e848a392edbdd (diff)
downloadtor-86105a4009bf3e128abfa3e735d8fa6f1f4d5975.tar.gz
tor-86105a4009bf3e128abfa3e735d8fa6f1f4d5975.zip
Check ENABLE_TOR2WEB_MODE before any tor2webmode code
-rw-r--r--changes/bug12844_macros4
-rw-r--r--src/or/circuituse.c2
-rw-r--r--src/or/config.c2
-rw-r--r--src/or/connection_edge.c2
-rw-r--r--src/or/rendclient.c7
5 files changed, 16 insertions, 1 deletions
diff --git a/changes/bug12844_macros b/changes/bug12844_macros
new file mode 100644
index 0000000000..bf3b2d8185
--- /dev/null
+++ b/changes/bug12844_macros
@@ -0,0 +1,4 @@
+ o Minor features (compilation):
+ - Do not compile any code related to Tor2Web mode when Tor2Web mode
+ is not enabled at compile time. Previously, this code was included
+ in a disabled state. See discussion on ticket #12844.
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index e11242a862..d0d31ad9cf 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -2036,11 +2036,13 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn,
else
new_circ_purpose = desired_circuit_purpose;
+#ifdef ENABLE_TOR2WEB_MODE
if (options->Tor2webMode &&
(new_circ_purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND ||
new_circ_purpose == CIRCUIT_PURPOSE_C_INTRODUCING)) {
want_onehop = 1;
}
+#endif
{
int flags = CIRCLAUNCH_NEED_CAPACITY;
diff --git a/src/or/config.c b/src/or/config.c
index f2c6221c35..fa0e753d86 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3037,6 +3037,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
options->PredictedPortsRelevanceTime = MAX_PREDICTED_CIRCS_RELEVANCE;
}
+#ifdef ENABLE_TOR2WEB_MODE
if (options->Tor2webMode && options->LearnCircuitBuildTimeout) {
/* LearnCircuitBuildTimeout and Tor2webMode are incompatible in
* two ways:
@@ -3068,6 +3069,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
"Tor2WebMode is enabled; disabling UseEntryGuards.");
options->UseEntryGuards = 0;
}
+#endif
if (options->Tor2webRendezvousPoints && !options->Tor2webMode) {
REJECT("Tor2webRendezvousPoints cannot be set without Tor2webMode.");
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index dd2f8d42a0..3c817decfb 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1278,6 +1278,7 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
return -1;
}
+#ifdef ENABLE_TOR2WEB_MODE
/* If we're running in Tor2webMode, we don't allow anything BUT .onion
* addresses. */
if (options->Tor2webMode) {
@@ -1287,6 +1288,7 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY);
return -1;
}
+#endif
/* See if this is a hostname lookup that we can answer immediately.
* (For example, an attempt to look up the IP address for an IP address.)
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 0c02243828..162e0ac53e 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -620,7 +620,12 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query)
char desc_id_base32[REND_DESC_ID_V2_LEN_BASE32 + 1];
time_t now = time(NULL);
char descriptor_cookie_base64[3*REND_DESC_COOKIE_LEN_BASE64];
+#ifdef ENABLE_TOR2WEB_MODE
const int tor2web_mode = options->Tor2webMode;
+ const int how_to_fetch = tor2web_mode ? DIRIND_ONEHOP : DIRIND_ANONYMOUS;
+#else
+ const int how_to_fetch = DIRIND_ANONYMOUS;
+#endif
int excluded_some;
tor_assert(desc_id);
tor_assert(rend_query);
@@ -697,7 +702,7 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query)
directory_initiate_command_routerstatus_rend(hs_dir,
DIR_PURPOSE_FETCH_RENDDESC_V2,
ROUTER_PURPOSE_GENERAL,
- tor2web_mode?DIRIND_ONEHOP:DIRIND_ANONYMOUS,
+ how_to_fetch,
desc_id_base32,
NULL, 0, 0,
rend_query);