[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torbutton/master] Bug 6009: Implement a Tor controller as a browser extension.



commit d183e97267685b4d57c1702826d7ff148e6c5eb9
Author: Kathy Brade <brade@xxxxxxxxxxxxxx>
Date:   Fri Apr 12 11:27:55 2013 -0400

    Bug 6009: Implement a Tor controller as a browser extension.
    
    As a fallback, obtain tor control password, host, port from Tor Launcher.
---
 src/chrome/content/torbutton.js |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 5a9ffab..bb58cce 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -428,16 +428,33 @@ function torbutton_init() {
         } catch(e) {
             torbutton_log(4, 'unable to read authentication cookie');
         }
-    }
+    } else {
+        // Try to get password from Tor Launcher.
+        try {
+		    let tlps = Cc["@torproject.org/torlauncher-protocol-service;1"]
+						 .getService(Ci.nsISupports).wrappedJSObject;
+            m_tb_control_pass = tlps.TorGetPassword(false);
+        } catch(e) {}
+	}
 
     if (environ.exists("TOR_CONTROL_PORT")) {
         m_tb_control_port = environ.get("TOR_CONTROL_PORT");
+    } else {
+        try {
+            const kTLControlPortPref = "extensions.torlauncher.control_port";
+            m_tb_control_port = m_tb_prefs.getIntPref(kTLControlPortPref);
+        } catch(e) {}
     }
 
     if (environ.exists("TOR_CONTROL_HOST")) {
         m_tb_control_host = environ.get("TOR_CONTROL_HOST");
     } else {
-        m_tb_control_host = "127.0.0.1";
+        try {
+            const kTLControlHostPref = "extensions.torlauncher.control_host";
+            m_tb_control_host = m_tb_prefs.getCharPref(kTLControlHostPref);
+        } catch(e) {
+            m_tb_control_host = "127.0.0.1";
+		}
     }
 
     // initialize preferences before we start our prefs observer



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits