Commit d7c7c577 authored by Mike Perry's avatar Mike Perry
Browse files

Bug 6254: Listen for TOR_TRANSPROXY env var to enable transproxy mode

Listen for the existence of the TOR_TRANSPROXY env var, and set prefs
appropriately.
parent 9790fdae
......@@ -151,7 +151,14 @@ function torbutton_check_status() {
else
remote_dns = true;
return ((liveprefs.getIntPref("type") == 1) &&
var proxy_type = 1;
if (torprefs.getCharPref('settings_method') == 'transparent') {
remote_dns = true; // Hack. Transparent has remote_dns disabled
proxy_type = 0;
}
return (
(liveprefs.getIntPref("type") == proxy_type) &&
torbutton_log(1, "Type is true") &&
(liveprefs.getCharPref("http") == torprefs.getCharPref('http_proxy')) &&
torbutton_log(1, "Http proxy") &&
......@@ -207,10 +214,18 @@ function torbutton_activate_tor_settings()
liveprefs.setIntPref('socks_version', torprefs.getIntPref('socks_version'));
liveprefs.setCharPref('no_proxies_on', torprefs.getCharPref('no_proxies_on'));
liveprefs.setBoolPref('share_proxy_settings', false);
if (torbutton_check_socks_remote_dns()) {
liveprefs.setBoolPref('socks_remote_dns', true);
if (torprefs.getCharPref('settings_method') == 'transparent') {
liveprefs.setIntPref('type', 0);
if (torbutton_check_socks_remote_dns()) {
liveprefs.setBoolPref('socks_remote_dns', false);
}
} else {
liveprefs.setIntPref('type', 1);
if (torbutton_check_socks_remote_dns()) {
liveprefs.setBoolPref('socks_remote_dns', true);
}
}
liveprefs.setIntPref('type', 1);
torbutton_log(2, 'Done activating tor settings');
}
......
......@@ -124,6 +124,12 @@ CrashObserver.prototype = {
parseInt(environ.get("TOR_SOCKS_PORT")));
if (this.is_tbb) {
this._prefs.setIntPref('network.proxy.socks_port', parseInt(environ.get("TOR_SOCKS_PORT")));
// XXX: Hack for TBB people who alternate between transproxy and non
this._prefs.setCharPref('extensions.torbutton.settings_method', 'recommended');
this._prefs.setBoolPref('extensions.torbutton.saved.transparentTor', false);
this._prefs.setBoolPref('network.proxy.socks_remote_dns', true);
this._prefs.setIntPref('network.proxy.type', 1);
}
} else if (this._prefs.getCharPref('extensions.torbutton.settings_method') == 'recommended') {
this._prefs.setIntPref('extensions.torbutton.socks_port', 9050);
......@@ -137,7 +143,20 @@ CrashObserver.prototype = {
} else if (this._prefs.getCharPref('extensions.torbutton.settings_method') == 'recommended') {
this._prefs.setCharPref('extensions.torbutton.socks_host', '127.0.0.1');
}
if (environ.exists("TOR_TRANSPROXY")) {
this.logger.log(3, "Resetting Tor settings to transproxy");
this._prefs.setCharPref('extensions.torbutton.settings_method', 'transparent');
this._prefs.setBoolPref('extensions.torbutton.saved.transparentTor', true);
this._prefs.setIntPref('extensions.torbutton.socks_port', 0);
this._prefs.setCharPref('extensions.torbutton.socks_host', "");
if (this.is_tbb) {
this._prefs.setBoolPref('network.proxy.socks_remote_dns', false);
this._prefs.setIntPref('network.proxy.type', 0);
this._prefs.setIntPref('network.proxy.socks_port', 0);
this._prefs.setCharPref('network.proxy.socks', "");
}
}
},
observe: function(subject, topic, data) {
......
Supports Markdown
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