Commit 6c064c5c authored by Kathleen Brade's avatar Kathleen Brade
Browse files

Bug #9445: Tor Launcher should be more relaxed about bridge line input.

Spaces are no longer turned into linebreaks.
The "bridge" prefix is optional, but it is always added for display
purposes.
parent 991e6307
......@@ -613,7 +613,7 @@ function initBridgeSettings()
if (!gProtocolSvc.TorCommandSucceeded(bridgeReply))
return false;
setElemValue(kBridgeList, bridgeReply.lineArray);
setBridgeListElemValue(bridgeReply.lineArray);
return true;
}
......@@ -828,7 +828,7 @@ function getAndValidateBridgeSettings()
return null;
}
setElemValue(kBridgeList, bridgeList);
setBridgeListElemValue(bridgeList);
if (useBridges && bridgeList)
{
settings[kTorConfKeyUseBridges] = true;
......@@ -856,19 +856,7 @@ function parseAndValidateBridges(aStr)
for (var i = 0; i < tmpArray.length; i++)
{
let s = tmpArray[i].trim(); // Remove extraneous whitespace.
if (s.indexOf(' ') >= 0)
{
// Handle a space-separated list of bridge specs.
var tmpArray2 = s.split(' ');
for (var j = 0; j < tmpArray2.length; ++j)
{
let s2 = tmpArray2[j];
if (s2.length > 0)
resultArray.push(s2);
}
}
else if (s.length > 0)
resultArray.push(s);
resultArray.push(s);
}
return (0 == resultArray.length) ? null : resultArray;
......@@ -963,6 +951,26 @@ function setElemValue(aID, aValue)
}
function setBridgeListElemValue(aBridgeArray)
{
// To be consistent with bridges.torproject.org, pre-pend "bridge" to
// each line as it is displayed in the UI.
var bridgeList = [];
for (var i = 0; i < aBridgeArray.length; ++i)
{
var s = aBridgeArray[i].trim();
if (s.length > 0)
{
if (s.toLowerCase().indexOf("bridge") != 0)
s = "bridge " + s;
bridgeList.push(s);
}
}
setElemValue(kBridgeList, bridgeList);
}
// Returns a Boolean (for checkboxes/radio buttons) or a
// string (textbox and menulist).
// Leading and trailing white space is trimmed from strings.
......
......@@ -43,7 +43,7 @@
<!ENTITY torsettings.firewall.checkbox "This computer goes through a firewall that only allows connections to certain ports">
<!ENTITY torsettings.firewall.allowedPorts "Allowed Ports:">
<!ENTITY torsettings.useBridges.checkbox "My Internet Service Provider (ISP) blocks connections to the Tor network">
<!ENTITY torsettings.useBridges.label "Enter one or more bridge relays in the form address:port.">
<!ENTITY torsettings.useBridges.label "Enter one or more bridge relays (one per line).">
<!ENTITY torsettings.useBridges.placeholder "address:port">
<!ENTITY torsettings.copyLog "Copy Tor Log To Clipboard">
......
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