[tor-commits] [tor/master] New option "--disable-system-torrc" to not read torrc from etc

nickm at torproject.org nickm at torproject.org
Sun Jan 18 21:07:16 UTC 2015


commit 6bb31cba1286e843ac7d32a24a9424587bc29623
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Jan 6 17:07:01 2015 -0500

    New option "--disable-system-torrc" to not read torrc from etc
    
    Implements 13037.
---
 changes/ticket13037 |    4 ++++
 configure.ac        |    7 +++++++
 src/or/config.c     |    5 ++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/changes/ticket13037 b/changes/ticket13037
new file mode 100644
index 0000000..24c4100
--- /dev/null
+++ b/changes/ticket13037
@@ -0,0 +1,4 @@
+  o Minor features (build):
+    - New --disable-system-torrc compile-time option to prevent Tor from
+      looking for a system-wide torrc or torrc-defaults tile. Resolves
+      ticket 13037.
diff --git a/configure.ac b/configure.ac
index 2c92a6c..920a12f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,8 @@ AC_ARG_ENABLE(unittests,
    AS_HELP_STRING(--disable-unittests, [Don't build unit tests for Tor. Risky!]))
 AC_ARG_ENABLE(coverage,
    AS_HELP_STRING(--enable-coverage, [Enable coverage support in the unit-test build]))
+AC_ARG_ENABLE(system-torrc,
+   AS_HELP_STRING(--disable-system-torrc, [Don't look for a system-wide torrc file]))
 
 AM_CONDITIONAL(UNITTESTS_ENABLED, test x$enable_unittests != xno)
 AM_CONDITIONAL(COVERAGE_ENABLED, test x$enable_coverage = xyes)
@@ -56,6 +58,11 @@ if test "$enable_static_tor" = "yes"; then
   CFLAGS="$CFLAGS -static"
 fi
 
+if test "$enable_system_torrc" = "no"; then
+  AC_DEFINE(DISABLE_SYSTEM_TORRC, 1,
+            [Defined if we're not going to look for a torrc in SYSCONF])
+fi
+
 if test x$enable_buf_freelists = xyes; then
   AC_DEFINE(ENABLE_BUF_FREELISTS, 1,
             [Defined if we try to use freelists for buffer RAM chunks])
diff --git a/src/or/config.c b/src/or/config.c
index 543d7fa..5bd5ff4 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -4013,7 +4013,10 @@ get_windows_conf_root(void)
 static const char *
 get_default_conf_file(int defaults_file)
 {
-#ifdef _WIN32
+#ifdef DISABLE_SYSTEM_TORRC
+  (void) defaults_file;
+  return NULL;
+#elif defined(_WIN32)
   if (defaults_file) {
     static char defaults_path[MAX_PATH+1];
     tor_snprintf(defaults_path, MAX_PATH, "%s\\torrc-defaults",





More information about the tor-commits mailing list