[or-cvs] r23855: {arm} Removing controller password from the loaded configuration v (arm/trunk/src)

Damian Johnson atagar1 at gmail.com
Mon Nov 22 18:02:59 UTC 2010


Author: atagar
Date: 2010-11-22 18:02:58 +0000 (Mon, 22 Nov 2010)
New Revision: 23855

Modified:
   arm/trunk/src/starter.py
Log:
Removing controller password from the loaded configuration values after it's used.



Modified: arm/trunk/src/starter.py
===================================================================
--- arm/trunk/src/starter.py	2010-11-22 17:51:02 UTC (rev 23854)
+++ arm/trunk/src/starter.py	2010-11-22 18:02:58 UTC (rev 23855)
@@ -254,9 +254,21 @@
   conn = TorCtl.TorCtl.connect(controlAddr, controlPort, authPassword)
   if conn == None: sys.exit(1)
   
-  # removing reference so memory can be freed (unfortunately python does allow
-  # for direct access to the memory so this is the best we can do)
+  # removing references to the controller password so the memory can be freed
+  # (unfortunately python does allow for direct access to the memory so this
+  # is the best we can do)
   del authPassword
+  if "startup.controlPassword" in config.contents:
+    del config.contents["startup.controlPassword"]
+    
+    pwLineNum = None
+    for i in range(len(config.rawContents)):
+      if config.rawContents[i].strip().startswith("startup.controlPassword"):
+        pwLineNum = i
+        break
+    
+    if pwLineNum != None:
+      del config.rawContents[i]
   
   # initializing the connection may require user input (for the password)
   # skewing the startup time results so this isn't counted



More information about the tor-commits mailing list