]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a compile-time #define to control whether Tor runs in 'tor2web mode'
authorRobert Ransom <rransom.8774@gmail.com>
Thu, 24 Nov 2011 00:58:15 +0000 (16:58 -0800)
committerNick Mathewson <nickm@torproject.org>
Wed, 30 Nov 2011 19:54:14 +0000 (14:54 -0500)
The Tor2webMode torrc option is still required to run a Tor client in
'tor2web mode', but now it can't be turned on at runtime in a normal build
of Tor.  (And a tor2web build of Tor can't be used as a normal Tor client,
so we don't have to worry as much about someone distributing packages with
this particular pistol accessible to normal users.)

src/or/config.c
src/or/or.h

index b2de15e7f0764d1432078de74ac4037693d2a7c8..bddae6fc226107e5a421bf427498704c84617041 100644 (file)
@@ -1294,6 +1294,22 @@ options_act(const or_options_t *old_options)
   if (consider_adding_dir_authorities(options, old_options) < 0)
     return -1;
 
+#ifdef ENABLE_TOR2WEB_MODE
+  if (!options->Tor2webMode) {
+    log_err(LD_CONFIG, "This copy of Tor was compiled to run in "
+            "'tor2web mode'. It can only be run with the Tor2webMode torrc "
+            "option enabled.");
+    return -1;
+  }
+#else
+  if (options->Tor2webMode) {
+    log_err(LD_CONFIG, "This copy of Tor was not compiled to run in "
+            "'tor2web mode'. It cannot be run with the Tor2webMode torrc "
+            "option enabled.");
+    return -1;
+  }
+#endif
+
   if (options->Bridges) {
     mark_bridge_list();
     for (cl = options->Bridges; cl; cl = cl->next) {
index 8515db6673517fa9774cd81e1e4d517154f04237..8117ee1f86f8f30b61c602e54bb63dbdb253a3d5 100644 (file)
 #define cell_t tor_cell_t
 #endif
 
+#ifdef ENABLE_TOR2WEB_MODE
+#define NON_ANONYMOUS_MODE_ENABLED 1
+#endif
+
 /** Length of longest allowable configured nickname. */
 #define MAX_NICKNAME_LEN 19
 /** Length of a router identity encoded as a hexadecimal digest, plus