[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [gettor/master] Create directory containing the password file if it doesn't exist already
commit 1e89a0ac9163c390e9145f2a01e4b922e7f4237a
Author: Christian Fromme <kaner@xxxxxxxxxx>
Date: Sat Mar 3 12:29:12 2012 +0100
Create directory containing the password file if it doesn't exist already
---
lib/gettor/utils.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/lib/gettor/utils.py b/lib/gettor/utils.py
index 509f90d..ed8a3d7 100644
--- a/lib/gettor/utils.py
+++ b/lib/gettor/utils.py
@@ -209,7 +209,11 @@ def setCmdPassword(conf, password):
logging.debug("Setting command password")
passwordHash = str(hashlib.sha1(password).hexdigest())
# Be nice: Create dir if it's not there
- passFile = os.path.join(conf.BASEDIR, 'etc', 'gettor', conf.PASSFILE)
+ passwordDir = os.path.join(conf.BASEDIR, 'etc', 'gettor')
+ if not createDir(passwordDir):
+ logging.error("Couldn't create password dir %s" % passwordDir)
+ return False
+ passFile = os.path.join(passwordDir, conf.PASSFILE)
try:
fd = open(passFile, 'w')
fd.write(passwordHash)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits