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

[vidalia-svn] r1921: Tor writes its state file even if all we're doing is --hash- (in trunk: . src/config)



Author: edmanm
Date: 2007-09-12 23:53:25 -0400 (Wed, 12 Sep 2007)
New Revision: 1921

Modified:
   trunk/
   trunk/src/config/torsettings.cpp
Log:
 r2148@adrastea:  edmanm | 2007-09-12 23:52:05 -0400
 Tor writes its state file even if all we're doing is --hash-password. So
 if the user has configured a non-default data directory, then include
 that in the list of command line arguments when we run 'tor --hash-password
 <foo>' to get the hash given for HashedControlPassword.



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

Modified: trunk/src/config/torsettings.cpp
===================================================================
--- trunk/src/config/torsettings.cpp	2007-09-12 05:07:17 UTC (rev 1920)
+++ trunk/src/config/torsettings.cpp	2007-09-13 03:53:25 UTC (rev 1921)
@@ -336,12 +336,20 @@
 TorSettings::hashPassword(QString password)
 {
   QProcess tor;
-  QString line;
- 
+  QString dataDirectory, line;
+  QStringList args;
+
+  /* Tor writes its state file even if all we're doing is --hash-password. So
+   * if the user has configured a non-default data directory, then include
+   * that in the list of command line arguments. */
+  dataDirectory = getDataDirectory();
+  if (!dataDirectory.isEmpty())
+    args << "DataDirectory" << dataDirectory;
+  args << "--hash-password" << password;
+  
   /* Run Tor, tell it to hash the given password, and then wait for it to
    * finish. */
-  tor.start(getExecutable(),
-            QStringList() << "--hash-password" << password);
+  tor.start(getExecutable(), args);
   if (!tor.waitForStarted() || !tor.waitForFinished())
     return QString();