Changeset 1517
- Timestamp:
- 11/10/06 15:40:14 (2 years ago)
- Files:
-
- accountmanagerplugin/0.10/acct_mgr/htfile.py (modified) (3 diffs)
- accountmanagerplugin/0.9/acct_mgr/htfile.py (modified) (3 diffs)
- accountmanagerplugin/trunk/acct_mgr/htfile.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
accountmanagerplugin/0.10/acct_mgr/htfile.py
r1502 r1517 30 30 from crypt import crypt 31 31 except ImportError: 32 def crypt(password, salt): 33 raise NotImplementedError('The "crypt" module is unavailable on this ' 34 'platform. Only MD5 passwords (starting ' 35 'with "$apr1$") are supported in the ' 36 'htpasswd file.') 32 crypt = None 37 33 38 34 # os.urandom was added in Python 2.4 … … 156 152 157 153 def userline(self, user, password): 158 return self.prefix(user) + md5crypt(password, salt(), '$apr1$') 154 if crypt is None: 155 return self.prefix(user) + md5crypt(password, salt(), '$apr1$') 156 else: 157 return self.prefix(user) + crypt(password, salt()) 159 158 160 159 def _check_userline(self, password, prefix, suffix): … … 165 164 return (suffix[5:] == 166 165 sha.new(password).digest().encode('base64')[:-1]) 166 elif crypt is None: 167 # crypt passwords are only supported on Unix-like systems 168 raise NotImplementedError('The "crypt" module is unavailable ' 169 'on this platform. Only MD5 ' 170 'passwords (starting with "$apr1$") ' 171 'are supported in the htpasswd file.') 167 172 else: 168 # crypt passwords are only supported on Unix-like systems169 # a dummy crypt implementation is provided above that throws170 # a NotImplementedError if the crypt module is unavailable171 173 return suffix == crypt(password, suffix[:2]) 172 174 accountmanagerplugin/0.9/acct_mgr/htfile.py
r1128 r1517 29 29 from crypt import crypt 30 30 except ImportError: 31 def crypt(password, salt): 32 raise NotImplementedError('The "crypt" module is unavailable on this ' 33 'platform. Only MD5 passwords (starting ' 34 'with "$apr1$") are supported in the ' 35 'htpasswd file.') 31 crypt = None 36 32 37 33 # os.urandom was added in Python 2.4 … … 150 146 151 147 def userline(self, user, password): 152 return self.prefix(user) + md5crypt(password, salt(), '$apr1$') 148 if crypt is None: 149 return self.prefix(user) + md5crypt(password, salt(), '$apr1$') 150 else: 151 return self.prefix(user) + crypt(password, salt()) 153 152 154 153 def _check_userline(self, password, prefix, suffix): … … 159 158 return (suffix[5:] == 160 159 sha.new(password).digest().encode('base64')[:-1]) 160 elif crypt is None: 161 # crypt passwords are only supported on Unix-like systems 162 raise NotImplementedError('The "crypt" module is unavailable ' 163 'on this platform. Only MD5 ' 164 'passwords (starting with "$apr1$") ' 165 'are supported in the htpasswd file.') 161 166 else: 162 # crypt passwords are only supported on Unix-like systems163 # a dummy crypt implementation is provided above that throws164 # a NotImplementedError if the crypt module is unavailable165 167 return suffix == crypt(password, suffix[:2]) 166 168 accountmanagerplugin/trunk/acct_mgr/htfile.py
r1128 r1517 30 30 from crypt import crypt 31 31 except ImportError: 32 def crypt(password, salt): 33 raise NotImplementedError('The "crypt" module is unavailable on this ' 34 'platform. Only MD5 passwords (starting ' 35 'with "$apr1$") are supported in the ' 36 'htpasswd file.') 32 crypt = None 37 33 38 34 # os.urandom was added in Python 2.4 … … 156 152 157 153 def userline(self, user, password): 158 return self.prefix(user) + md5crypt(password, salt(), '$apr1$') 154 if crypt is None: 155 return self.prefix(user) + md5crypt(password, salt(), '$apr1$') 156 else: 157 return self.prefix(user) + crypt(password, salt()) 159 158 160 159 def _check_userline(self, password, prefix, suffix): … … 165 164 return (suffix[5:] == 166 165 sha.new(password).digest().encode('base64')[:-1]) 166 elif crypt is None: 167 # crypt passwords are only supported on Unix-like systems 168 raise NotImplementedError('The "crypt" module is unavailable ' 169 'on this platform. Only MD5 ' 170 'passwords (starting with "$apr1$") ' 171 'are supported in the htpasswd file.') 167 172 else: 168 # crypt passwords are only supported on Unix-like systems169 # a dummy crypt implementation is provided above that throws170 # a NotImplementedError if the crypt module is unavailable171 173 return suffix == crypt(password, suffix[:2]) 172 174
