Changeset 1042
- Timestamp:
- 07/19/06 20:12:16 (2 years ago)
- Files:
-
- accountmanagerplugin/0.9/acct_mgr/htfile.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
accountmanagerplugin/0.9/acct_mgr/htfile.py
r963 r1042 21 21 22 22 from api import IPasswordStore 23 24 # check for the availability of the "crypt" module for checking passwords on 25 # Unix-like platforms 26 # MD5 is still used when adding/updating passwords 27 try: 28 from crypt import crypt 29 except ImportError: 30 def crypt(password, salt): 31 raise NotImplementedError('The "crypt" module is unavailable on this ' 32 'platform. Only MD5 passwords (starting ' 33 'with "$apr1$") are supported in the ' 34 'htpasswd file.') 23 35 24 36 # os.urandom was added in Python 2.4 … … 123 135 124 136 def _check_userline(self, password, prefix, suffix): 125 if not suffix.startswith('$apr1$'): 126 return False 127 return suffix == md5crypt(password, suffix[6:].split('$')[0], '$apr1$') 137 if suffix.startswith('$apr1$'): 138 return suffix == md5crypt(password, suffix[6:].split('$')[0], 139 '$apr1$') 140 else: 141 # crypt passwords are only supported on Unix-like systems 142 # a dummy crypt implementation is provided above that throws 143 # a NotImplementedError if the crypt module is unavailable 144 return suffix == crypt(password, suffix[:2]) 128 145 129 146 def _get_users(self, filename):
