split htpasswd entries to no more than two parts
authorchrysn <chrysn@fsfe.org>
Tue, 17 Jan 2012 14:15:58 +0000 (15:15 +0100)
committerKeith Packard <keithp@keithp.com>
Tue, 17 Jan 2012 16:30:58 +0000 (08:30 -0800)
this avoids an error that occurs when a ':' occurs inside an unencrypted
(plain) password

calypso/acl/htpasswd.py

index e6fdcbc41c35c124d8bc940d22ca031bca3afec4..ae403683baa2da3957fd1496da845494222cee85 100644 (file)
@@ -60,7 +60,7 @@ def has_right(owner, user, password):
     print "checking access for user %s" % user
     for line in open(FILENAME).readlines():
         if line.strip():
-            login, hash_value = line.strip().split(":")
+            login, hash_value = line.strip().split(":", 1)
             if login == user and (not PERSONAL or user == owner):
                 return CHECK_PASSWORD(hash_value, password)
     return False