Changeset 27083
- Timestamp:
- 07/02/2009 12:08:56 PM (14 months ago)
- Location:
- branches/spwd-3242-3/twisted/conch
- Files:
-
- 2 modified
-
checkers.py (modified) (3 diffs)
-
test/test_checkers.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/spwd-3242-3/twisted/conch/checkers.py
r27082 r27083 58 58 59 59 @param username: the username of the user to return the passwd database 60 information for.60 information for. 61 61 """ 62 62 if not pwd: … … 72 72 73 73 @param username: the username of the user to return the shadow database 74 information for.74 information for. 75 75 """ 76 76 if not shadow: … … 82 82 class UNIXPasswordDatabase: 83 83 """ 84 A checker which validates users out of the UNIX password databases, or a85 databases a compatible format.84 A checker which validates users out of the UNIX password databases, or 85 databases of a compatible format. 86 86 87 87 @ivar getpwnamFunctions: a C{tuple} of functions which are called in order 88 to valid a user. The default value is (getpwnamPasswd, getpwnamShadow),89 which tries the /etc/passwd database first, followed by the /etc/shadow90 database.88 to valid a user. The default value is (getpwnamPasswd, getpwnamShadow), 89 which tries the /etc/passwd database first, followed by the /etc/shadow 90 database. 91 91 """ 92 92 credentialInterfaces = IUsernamePassword, -
branches/spwd-3242-3/twisted/conch/test/test_checkers.py
r27082 r27083 17 17 try: 18 18 import Crypto.Cipher.DES3 19 Crypto20 19 import pyasn1 21 20 except ImportError: … … 117 116 return True 118 117 self.patch(self.checker, 'checkKey', _checkKey) 119 credentials = SSHPrivateKey('test', 'ssh-rsa', 120 keydata.publicRSA_openssh, 'foo', 121 keys.Key.fromString( 122 keydata.privateRSA_openssh).sign('foo')) 118 credentials = SSHPrivateKey( 119 'test', 'ssh-rsa', keydata.publicRSA_openssh, 'foo', 120 keys.Key.fromString(keydata.privateRSA_openssh).sign('foo')) 123 121 d = self.checker.requestAvatarId(credentials) 124 122 def _verify(avatarId): … … 137 135 return True 138 136 self.patch(self.checker, 'checkKey', _checkKey) 139 credentials = SSHPrivateKey( 'test', 'ssh-rsa',140 keydata.publicRSA_openssh, None, None)137 credentials = SSHPrivateKey( 138 'test', 'ssh-rsa', keydata.publicRSA_openssh, None, None) 141 139 d = self.checker.requestAvatarId(credentials) 142 140 return self.assertFailure(d, ValidPublicKey) … … 164 162 return True 165 163 self.patch(self.checker, 'checkKey', _checkKey) 166 credentials = SSHPrivateKey('test', 'ssh-rsa', 167 keydata.publicRSA_openssh, 'foo', 168 keys.Key.fromString( 169 keydata.privateDSA_openssh).sign('foo')) 164 credentials = SSHPrivateKey( 165 'test', 'ssh-rsa', keydata.publicRSA_openssh, 'foo', 166 keys.Key.fromString(keydata.privateDSA_openssh).sign('foo')) 170 167 d = self.checker.requestAvatarId(credentials) 171 168 return self.assertFailure(d, UnauthorizedLogin) … … 284 281 L{getpwnamShadow}. 285 282 """ 286 if checkers. pwdis None:283 if checkers.crypt is None: 287 284 skip = 'cannot run without crypt module' 288 elif not getattr(os, 'O_NOCTTY', None):289 skip = 'cannot run without os.O_NOCTTY'290 285 291 286
