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

[vidalia-svn] r1854: Try a PROTOCOLINFO before we authenticate and use the inform (in trunk: . src/gui)



Author: edmanm
Date: 2007-08-22 21:06:29 -0400 (Wed, 22 Aug 2007)
New Revision: 1854

Modified:
   trunk/
   trunk/src/gui/mainwindow.cpp
Log:
 r2026@adrastea:  edmanm | 2007-08-22 21:05:48 -0400
 Try a PROTOCOLINFO before we authenticate and use the information from that
 response (if we get one) to choose an authentication method.



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /vidalia/local/trunk [r2026] on 54b3572a-7227-0410-958f-53ecd705b71a

Modified: trunk/src/gui/mainwindow.cpp
===================================================================
--- trunk/src/gui/mainwindow.cpp	2007-08-23 01:06:21 UTC (rev 1853)
+++ trunk/src/gui/mainwindow.cpp	2007-08-23 01:06:29 UTC (rev 1854)
@@ -708,13 +708,25 @@
 {
   TorSettings::AuthenticationMethod authMethod;
   TorSettings settings;
-
+  ProtocolInfo pi;
+  
   updateTorStatus(Authenticating);
   
+  pi = _torControl->protocolInfo();
+  if (!pi.isEmpty()) {
+    QStringList authMethods = pi.authMethods();
+    if (authMethods.contains("COOKIE"))
+      settings.setAuthenticationMethod(TorSettings::CookieAuth);
+    else if (authMethods.contains("HASHEDPASSWORD"))
+      settings.setAuthenticationMethod(TorSettings::PasswordAuth);
+    else if (authMethods.contains("NULL"))
+      settings.setAuthenticationMethod(TorSettings::NullAuth);
+  }
+      
   authMethod = settings.getAuthenticationMethod(); 
   if (authMethod == TorSettings::CookieAuth) {
     /* Try to load an auth cookie and send it to Tor */
-    QByteArray cookie = loadControlCookie();
+    QByteArray cookie = loadControlCookie(pi.cookieAuthFile());
     while (cookie.isEmpty()) {
       /* Prompt the user to find their control_auth_cookie */
       int ret = VMessageBox::question(this,