[tor-commits] [arm/master] Previous cookie path change broke general uses

atagar at torproject.org atagar at torproject.org
Mon Sep 12 15:37:44 UTC 2011


commit e5fa6d9b99f7eabac6d86e1d4952173d4aad70f5
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Sep 12 08:36:26 2011 -0700

    Previous cookie path change broke general uses
    
    The hack to account for os.path.join's dumb implementation broke the general
    use case where the user *doesn't* have a path prefix by making it relative...
    oops.
---
 src/starter.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/starter.py b/src/starter.py
index e4e7096..dd5f5c9 100644
--- a/src/starter.py
+++ b/src/starter.py
@@ -233,10 +233,11 @@ def _torCtlConnect(controlAddr="127.0.0.1", controlPort=9051, passphrase=None, i
       # with the second argument then it will swallow the prefix. Ie...
       # os.path.join("/tmp", "/foo") => "/foo"
       
-      pathSuffix = conn._cookiePath
-      if pathSuffix.startswith("/"): pathSuffix = pathSuffix[1:]
-      
-      conn._cookiePath = os.path.join(pathPrefix, pathSuffix)
+      if pathPrefix:
+        pathSuffix = conn._cookiePath
+        if pathSuffix.startswith("/"): pathSuffix = pathSuffix[1:]
+        
+        conn._cookiePath = os.path.join(pathPrefix, pathSuffix)
     
     conn.authenticate(authValue)
     return conn



More information about the tor-commits mailing list