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

[tor-commits] [arm/master] Simplification for wiping the controller password



commit d7c9af39f2038910930058c0554657c1a53dd4c4
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Sep 14 17:28:08 2013 -0700

    Simplification for wiping the controller password
    
    Stem's Config class no longer tracks the originally read contents...
    
    https://gitweb.torproject.org/stem.git/commitdiff/e2cff0b
    
    So wiping the controller password is now as simple as calling its set() method.
    This both removes the Config's reference to the controller password and also
    blanks it in any dictionaries managed by config_dict().
---
 arm/starter.py |   12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/arm/starter.py b/arm/starter.py
index fa2289d..f84937d 100644
--- a/arm/starter.py
+++ b/arm/starter.py
@@ -344,18 +344,8 @@ def main():
   # Removing references to the controller password so the memory can be
   # freed. Without direct memory access this is about the best we can do.
 
-  if "tor.password" in config._contents:
-    del config._contents["tor.password"]
+  config.set('tor.password', '')
 
-    pwLineNum = None
-    for i in range(len(config._raw_contents)):
-      if config._raw_contents[i].strip().startswith("tor.password"):
-        pwLineNum = i
-        break
-
-    if pwLineNum != None:
-      del config._raw_contents[i]
-  
   # initializing the connection may require user input (for the password)
   # skewing the startup time results so this isn't counted
   initTime = time.time() - startTime



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