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

[vidalia-svn] r2213: Don't try to 'setconf hashedcontrolpassword' if we couldn't (in trunk: . src/vidalia/config)



Author: edmanm
Date: 2007-12-11 22:28:39 -0500 (Tue, 11 Dec 2007)
New Revision: 2213

Modified:
   trunk/
   trunk/src/vidalia/config/torsettings.cpp
Log:
 r2295@lysithea:  edmanm | 2007-12-11 22:28:13 -0500
 Don't try to 'setconf hashedcontrolpassword' if we couldn't hash the control
 password, otherwise we'd end up disabling authentication.



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /local/vidalia/trunk [r2295] on 0108964c-5b0b-4c9e-969f-e2288315d100

Modified: trunk/src/vidalia/config/torsettings.cpp
===================================================================
--- trunk/src/vidalia/config/torsettings.cpp	2007-12-12 03:28:31 UTC (rev 2212)
+++ trunk/src/vidalia/config/torsettings.cpp	2007-12-12 03:28:39 UTC (rev 2213)
@@ -97,6 +97,7 @@
 TorSettings::apply(QString *errmsg)
 {
   QHash<QString, QString> conf;
+  QString hashedPassword;
 
   conf.insert(SETTING_CONTROL_PORT,
               localValue(SETTING_CONTROL_PORT).toString());
@@ -109,11 +110,16 @@
       conf.insert(TOR_ARG_HASHED_PASSWORD, "");
       break;
     case PasswordAuth:
+      hashedPassword = useRandomPassword() 
+                          ? hashPassword(randomPassword())
+                          : hashPassword(getControlPassword());
+      if (hashedPassword.isEmpty()) {
+        if (errmsg)
+          *errmsg =  tr("Failed to hash the control password.");
+        return false;
+      }
       conf.insert(TOR_ARG_COOKIE_AUTH,    "0");
-      conf.insert(TOR_ARG_HASHED_PASSWORD,
-        useRandomPassword() 
-            ? hashPassword(randomPassword())
-            : hashPassword(getControlPassword()));
+      conf.insert(TOR_ARG_HASHED_PASSWORD, hashedPassword);
       break;
     default:
       conf.insert(TOR_ARG_COOKIE_AUTH,    "0");