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

[tor-commits] [arm/master] fix: appending path prefix to auth cookie path



commit 61eca7e9c9ca331e9a6cef082e628df5f6aa78a0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Thu Sep 8 09:05:51 2011 -0700

    fix: appending path prefix to auth cookie path
    
    Manually declared path prefixes weren't being applied to authentication
    cookies, so chroot instances using cookie auth couldn't connect. Caught by
    sid77
---
 src/starter.py       |    5 +++++
 src/util/torTools.py |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/starter.py b/src/starter.py
index a2617f7..6953cf4 100644
--- a/src/starter.py
+++ b/src/starter.py
@@ -225,6 +225,11 @@ def _torCtlConnect(controlAddr="127.0.0.1", controlPort=9051, passphrase=None, i
         try: conn._cookiePath = util.sysTools.expandRelativePath(authValue, torPid)
         except IOError: pass
     
+    # appends the path prefix if it's set
+    if authType == TorCtl.TorCtl.AUTH_TYPE.COOKIE:
+      pathPrefix = util.torTools.getConn().getPathPrefix()
+      authValue = os.path.join(pathPrefix, authValue)
+    
     conn.authenticate(authValue)
     return conn
   except Exception, exc:
diff --git a/src/util/torTools.py b/src/util/torTools.py
index 8567158..c81847c 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -1913,8 +1913,11 @@ class Controller(TorCtl.PostEventListener):
     
     self.connLock.acquire()
     
+    # Checks that the value is unset and we're running. One exception to this
+    # is the pathPrefix which doesn't depend on having a connection and may be
+    # needed for the init.
     currentVal, result = self._cachedParam.get(key), None
-    if currentVal == None and self.isAlive():
+    if currentVal == None and (self.isAlive() or key == "pathPrefix"):
       # still unset - fetch value
       if key in ("nsEntry", "descEntry"):
         myFingerprint = self.getInfo("fingerprint")

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