GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 2545a772 authored by Tails developers's avatar Tails developers Committed by Kathleen Brade
Browse files

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.
parent ce36cfd7
......@@ -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();
......
......@@ -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);
......
......@@ -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);
},
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment