[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-launcher/master] Bug 22283: Linux 7.0a4 broken after update
commit 123a3ed987bef91c006957394da0465132954b3f
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date: Tue May 23 11:57:08 2017 -0400
Bug 22283: Linux 7.0a4 broken after update
Improve our torrc fixup code to remove all ControlPort and SocksPort
lines that contain a Unix domain socket, and execute the fixup one
more time. This corrects a problem where the torrc of alpha channel
users who transitioned from Unix domain sockets to TCP was left
with ControlPort and SocksPort lines that contained bad paths (the
parent directory for the Unix domain socket did not exist).
---
src/components/tl-process.js | 51 ++++++++++++--------------------------------
1 file changed, 14 insertions(+), 37 deletions(-)
diff --git a/src/components/tl-process.js b/src/components/tl-process.js
index 3db394e..ca38e9c 100644
--- a/src/components/tl-process.js
+++ b/src/components/tl-process.js
@@ -99,15 +99,16 @@ TorProcessService.prototype =
}
else if (TorLauncherUtil.shouldStartAndOwnTor)
{
- // If we have not already done so, perform a one-time fixup to remove
- // any ControlPort and SocksPort lines from the user's torrc file that
- // will conflict with the arguments we plan to pass when starting tor.
- // See bug 20761.
+ // If we have not already done so, remove any ControlPort and
+ // SocksPort lines from the user's torrc file that may conflict
+ // with the arguments we plan to pass when starting tor.
+ // See bugs 20761 and 22283.
+ const kTorrcFixupVersion = 2;
const kTorrcFixupPref = "extensions.torlauncher.torrc_fixup_version";
- if ((TorLauncherUtil.getIntPref(kTorrcFixupPref, 0) < 1)
- && this._fixupTorrc())
+ if ((TorLauncherUtil.getIntPref(kTorrcFixupPref, 0)
+ < kTorrcFixupVersion) && this._fixupTorrc())
{
- TorLauncherUtil.setIntPref(kTorrcFixupPref, 1);
+ TorLauncherUtil.setIntPref(kTorrcFixupPref, kTorrcFixupVersion);
}
this._startTor();
@@ -839,12 +840,8 @@ TorProcessService.prototype =
let matchResult = aLine.match(/\s*\+*controlport\s+(.*)/i);
if (matchResult)
{
- if (controlIPCFile)
- {
- removeLine = this._valueContainsFilePath(matchResult[1],
- controlIPCFile);
- }
- else
+ removeLine = this._valueIsUnixDomainSocket(matchResult[1]);
+ if (!removeLine && !controlIPCFile)
{
removeLine = this._valueContainsPort(matchResult[1],
controlPort);
@@ -857,12 +854,8 @@ TorProcessService.prototype =
matchResult = aLine.match(/\s*\+*socksport\s+(.*)/i);
if (matchResult)
{
- if (socksPortInfo.ipcFile)
- {
- removeLine = this._valueContainsFilePath(matchResult[1],
- socksPortInfo.ipcFile);
- }
- else
+ removeLine = this._valueIsUnixDomainSocket(matchResult[1]);
+ if (!removeLine && !socksPortInfo.ipcFile)
{
removeLine = this._valueContainsPort(matchResult[1],
socksPortInfo.port);
@@ -1059,7 +1052,7 @@ TorProcessService.prototype =
return lines;
},
- _valueContainsFilePath: function(aValue, aFile)
+ _valueIsUnixDomainSocket: function(aValue)
{
// Handle several cases:
// "unix:/path options"
@@ -1068,23 +1061,7 @@ TorProcessService.prototype =
if (aValue.startsWith('"'))
aValue = this.mProtocolSvc.TorUnescapeString(aValue);
- let path;
- let matchResult = aValue.match(/^unix:("[^"]*")/);
- if (matchResult)
- path = this.mProtocolSvc.TorUnescapeString(matchResult[1]);
- else
- {
- matchResult = aValue.match(/^unix:(\S*)/);
- if (matchResult)
- path = matchResult[1];
- }
-
- if (!path)
- return false;
-
- let file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
- file.initWithPath(path);
- return file.equals(aFile);
+ return aValue.startsWith("unix:");
},
_valueContainsPort: function(aValue, aPort)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits