commit 2545a772f23fe28127bbca17d1c6e89fd1aebfa1 Author: Tails developers amnesia@boum.org Date: Mon Feb 17 20:22:29 2014 +0100
If TOR_CONFIGURE_ONLY=1, only configure Tor.
This option prevents Tor Launcher from starting a Tor process but it will try to configure any already started Tor process without taking ownership of it. This option is intended for situations where Tor Launcher is supposed to configure an already started, system-wide Tor instance.
Note that it's not the same as TOR_SKIP_LAUNCH (and, equivalently, `extensions.torlauncher.start_tor`), which prevents *both* start and configuration of Tor. --- src/components/tl-process.js | 6 +++++- src/components/tl-protocol.js | 3 ++- src/modules/tl-util.jsm | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/components/tl-process.js b/src/components/tl-process.js index b542fc4..2517ae5 100644 --- a/src/components/tl-process.js +++ b/src/components/tl-process.js @@ -89,7 +89,11 @@ TorProcessService.prototype = this.mObsSvc.addObserver(this, kUserQuitTopic, false); this.mObsSvc.addObserver(this, kBootstrapStatusTopic, false);
- if (TorLauncherUtil.shouldStartAndOwnTor) + if (TorLauncherUtil.shouldOnlyConfigureTor) + { + this._controlTor(); + } + else if (TorLauncherUtil.shouldStartAndOwnTor) { this._startTor(); this._controlTor(); diff --git a/src/components/tl-protocol.js b/src/components/tl-protocol.js index 72530ea..e73f2e9 100644 --- a/src/components/tl-protocol.js +++ b/src/components/tl-protocol.js @@ -568,7 +568,8 @@ TorProtocolService.prototype = return null; }
- if (!aIsEventConnection && TorLauncherUtil.shouldStartAndOwnTor) + if (!aIsEventConnection && TorLauncherUtil.shouldStartAndOwnTor && + !TorLauncherUtil.shouldOnlyConfigureTor) { // Try to become the primary controller (TAKEOWNERSHIP). reply = this._sendCommand(conn, "TAKEOWNERSHIP", null); diff --git a/src/modules/tl-util.jsm b/src/modules/tl-util.jsm index ef13a72..5b1c6c0 100644 --- a/src/modules/tl-util.jsm +++ b/src/modules/tl-util.jsm @@ -196,6 +196,22 @@ let TorLauncherUtil = // Public
return this.getBoolPref(kPrefStartTor, true); }, + + get shouldOnlyConfigureTor() + { + const kPrefOnlyConfigureTor = "extensions.torlauncher.only_configure_tor"; + try + { + const kEnvOnlyConfigureTor = "TOR_CONFIGURE_ONLY"; + + var env = Cc["@mozilla.org/process/environment;1"] + .getService(Ci.nsIEnvironment); + if (env.exists(kEnvOnlyConfigureTor)) + return ("1" == env.get(kEnvOnlyConfigureTor)); + } catch(e) {} + + return this.getBoolPref(kPrefOnlyConfigureTor, false); + }, };
tor-commits@lists.torproject.org