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

[tor-commits] [vidalia/master] Provides the controlport and passwd as an env var



commit bb0e264a3a48e3c148a78468459748d2a5d8c2f8
Author: Tomas Touceda <chiiph@xxxxxxxxxxxxxx>
Date:   Thu Jul 28 13:50:41 2011 -0300

    Provides the controlport and passwd as an env var
    
    If Vidalia's configured to use ControlPort and PasswordAuth then it creates
    TOR_CONTROL_PORT and TOR_CONTROL_PASSWD for TorButton.
---
 src/vidalia/MainWindow.cpp |   10 ++++++++--
 src/vidalia/MainWindow.h   |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index 9f64163..0173c69 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -1156,8 +1156,8 @@ MainWindow::started()
       if(addrPort.size() != 2) return;
 
       QHostAddress addr(addrPort.at(0));
-      quint16 port = addrPort.at(1).toInt();
-      _torControl->connect(addr, port);
+      _autoControlPort = addrPort.at(1).toInt();
+      _torControl->connect(addr, _autoControlPort);
     }
   } else {
     /* Try to connect to Tor's control port */
@@ -2032,5 +2032,11 @@ MainWindow::updateBrowserEnv() {
     env << QString("TOR_SOCKS_PORT=%1").arg(port);
   }
 
+  if(settings.getAuthenticationMethod() == TorSettings::PasswordAuth) {
+    env << QString("TOR_CONTROL_PASSWD=%1").arg(settings.getControlPassword());
+    env << QString("TOR_CONTROL_PORT=%1").arg(_autoControlPort);
+    qWarning() << env;
+  }
+
   return env;
 }
diff --git a/src/vidalia/MainWindow.h b/src/vidalia/MainWindow.h
index 1412ec5..dc251e1 100644
--- a/src/vidalia/MainWindow.h
+++ b/src/vidalia/MainWindow.h
@@ -288,6 +288,8 @@ private:
   QAction* _actionShowNetworkMap;
   QAction* _actionNewIdentity;
 
+  quint16 _autoControlPort;
+
   Ui::MainWindow ui; /**< Qt Designer generated object. */
 };
 



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