+
    üÐj4y  ã                   ór  a € R. t@0 t R t^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ] ^ k  ^ RItRt^ RIHt ^ RIHt ^ R	IHtHtHtHt ^ R
IHtHt ^ RIHt ^ RIHt ^ RIHtH t  ^ RI!H"t" ^ RI#H$t$ ^ RI%H&t& ^ RI'H(t( ]$! R4      '       d   Rt)^ RI*H+t+ ^ RI,H-t-H.t. ^ RI/H0t0 ^ RI1H2t2 MRt)]3! ]RR4      e   Rt4MRt4 ! R R](4      t5 ! R R](4      t6 ! R R](4      t7 ! R  R!](4      t8 ! R" R#](4      t9 ! R$ R%](4      t: ! R& R'](4      t;]! R(R).4      t< ! R* R+]=4      t> ! R, R-](4      t?R#   ] d    Rt ELi ; i)/z&
Tests for L{twisted.conch.checkers}.
N)Úencodebytes)Ú
namedtuple)ÚBytesIO)ÚOptionalzcannot run without crypt module)ÚverifyObject)Ú'InMemoryUsernamePasswordDatabaseDontUse)ÚISSHPrivateKeyÚIUsernamePasswordÚSSHPrivateKeyÚUsernamePassword)ÚUnauthorizedLoginÚUnhandledCredentials)ÚDeferred)Úutil)ÚShadowDatabaseÚUserDatabase)ÚFilePath)ÚrequireModule)ÚMockOS)ÚTestCaseÚcryptography)Úcheckers)ÚNotEnoughAuthenticationÚValidPublicKey)Úkeys)Úkeydatazcan't run without cryptographyÚgeteuidz0Cannot run without effective UIDs (questionable)c                   ól   a € ] tR t^8t o Rt];'       g    ]tR tR t	R t
R tR tR tR tR	 tR
tV tR# )ÚHelperTestsz`
Tests for helper functions L{verifyCryptedPassword}, L{_pwdGetByName} and
L{_shadowGetByName}.
c                ó$   € \        4       V n        R # ©N)r   Úmockos©Úselfs   &ÚB/usr/lib/python3/dist-packages/twisted/conch/test/test_checkers.pyÚsetUpÚHelperTests.setUp@   s   € Ü“hˆŽó    c                ó¤   € RpRp\         P                   ! W4      pV P                  \        P                  ! W14      RP	                  W14      4       R# )z~
L{verifyCryptedPassword} returns C{True} if the plaintext password
passed to it matches the encrypted password passed to it.
úsecret stringÚsaltyz5{!r} supposed to be valid encrypted password for {!r}N©ÚcryptÚ
assertTruer   ÚverifyCryptedPasswordÚformat©r#   ÚpasswordÚsaltÚcrypteds   &   r$   Útest_verifyCryptedPasswordÚ&HelperTests.test_verifyCryptedPasswordC   sG   € ð
 #ˆØˆÜ—+’+˜hÓ-ˆØ�‰Ü×*Ò*¨7Ó=ØC×JÑJØóö	
r'   c                ó¤   € RpRp\         P                   ! W4      pV P                  \        P                  ! W14      RP	                  W14      4       R# )zr
L{verifyCryptedPassword} returns True if the provided cleartext password
matches the provided MD5 password hash.
r1   z$1$saltz3{!r} supposed to be valid encrypted password for {}Nr+   r0   s   &   r$   Útest_verifyCryptedPasswordMD5Ú)HelperTests.test_verifyCryptedPasswordMD5R   sG   € ð
 ˆØˆÜ—+’+˜hÓ-ˆØ�‰Ü×*Ò*¨7Ó=ØA×HÑHØóö	
r'   c                ó¨   € RpRpRp\         P                   ! W4      pV P                  \        P                  ! WC4      RP	                  WC4      4       R# )z†
L{verifyCryptedPassword} returns C{False} if the plaintext password
passed to it does not match the encrypted password passed to it.
zstring secretÚsomesaltr)   z7{!r} not supposed to be valid encrypted password for {}N)r,   ÚassertFalser   r.   r/   )r#   r1   r2   Úwrongr3   s   &    r$   Útest_refuteCryptedPasswordÚ&HelperTests.test_refuteCryptedPassworda   sN   € ð
 #ˆØˆØˆÜ—+’+˜hÓ-ˆØ×ÑÜ×*Ò*¨7Ó:ØE×LÑLØóö	
r'   c           	     óà   € \        4       pVP                  RR^^RRR4       V P                  \        RV4       V P	                  \        P
                  ! R4      VP                  R4      4       R# )zo
L{_pwdGetByName} returns a tuple of items from the UNIX /etc/passwd
database if the L{pwd} module is present.
ÚaliceÚsecritú
first lastú/fooú/bin/shÚpwdN)r   ÚaddUserÚpatchr   ÚassertEqualÚ_pwdGetByNameÚgetpwnam©r#   Úuserdbs   & r$   Útest_pwdGetByNameÚHelperTests.test_pwdGetByNameq   sW   € ô
 “ˆØ�‰�w ¨!¨Q°¸fÀiÔPØ�
‰
”8˜U FÔ+Ø×Ñœ×/Ò/°Ó8¸&¿/¹/È'Ó:RÖSr'   c                ó~   € V P                  \        RR4       V P                  \        P                  ! R4      4       R# )zG
If the C{pwd} module isn't present, L{_pwdGetByName} returns L{None}.
rE   Nr@   )rG   r   ÚassertIsNonerI   r"   s   &r$   Útest_pwdGetByNameWithoutPwdÚ'HelperTests.test_pwdGetByNameWithoutPwd{   s-   € ð 	�
‰
”8˜U DÔ)Ø×Ñœ(×0Ò0°Ó9Ö:r'   c                ó
  € \        4       pVP                  RR^^^^^^^4	       V P                  \        RV4       RV P                  n        RV P                  n        V P                  \        RV P                  4       V P                  \        P                  ! R4      VP                  R4      4       V P                  V P                  P                  ^ R.4       V P                  V P                  P                  ^ R.4       R# )zl
L{_shadowGetByName} returns a tuple of items from the UNIX /etc/shadow
database if the L{spwd} is present.
ÚbobÚ
passphraseÚspwdé)	  éÒ  ÚosN)r   rF   rG   r   r!   ÚeuidÚegidr   rH   Ú_shadowGetByNameÚgetspnamÚseteuidCallsÚsetegidCallsrK   s   & r$   Útest_shadowGetByNameÚ HelperTests.test_shadowGetByName‚   sÄ   € ô
  Ó!ˆØ�‰�u˜l¨A¨q°!°Q¸¸1¸aÔ@Ø�
‰
”8˜V VÔ,àˆ�‰ÔØˆ�‰ÔØ�
‰
”4˜˜tŸ{™{Ô+à×Ñœ×2Ò2°5Ó9¸6¿?¹?È5Ó;QÔRØ×Ñ˜Ÿ™×1Ñ1°A°t°9Ô=Ø×Ñ˜Ÿ™×1Ñ1°A°t°9Ö=r'   c                ó  € V P                  \        RR4       V P                  \        P                  ! R4      4       V P	                  V P
                  P                  . 4       V P	                  V P
                  P                  . 4       R# )z@
L{_shadowGetByName} returns L{None} if C{spwd} is not present.
rV   NrT   )rG   r   rP   r\   rH   r!   r^   r_   r"   s   &r$   Útest_shadowGetByNameWithoutSpwdÚ+HelperTests.test_shadowGetByNameWithoutSpwd“   sa   € ð 	�
‰
”8˜V TÔ*à×Ñœ(×3Ò3°EÓ:Ô;Ø×Ñ˜Ÿ™×1Ñ1°2Ô6Ø×Ñ˜Ÿ™×1Ñ1°2Ö6r'   )r!   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	cryptSkipÚdependencySkipÚskipr%   r4   r7   r=   rM   rQ   r`   rc   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r$   r   r   8   sG   ø‡ € ñð
 ×&Ð&˜€Dòò
ò
ò
ò Tò;ò>÷"7ð 7r'   r   c                   óŠ   a € ] tR t^žt o Rt];'       g    ]tV 3R lR ltR t	R t
R tR tR tR	 tR
 tR tR tR tRtV tR# )ÚSSHPublicKeyDatabaseTestsz$
Tests for L{SSHPublicKeyDatabase}.
c                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnN© )r/   rp   s   "€r$   Ú__annotate__Ú&SSHPublicKeyDatabaseTests.__annotate__¥   s   ø€ ÷ &ñ &�tñ &r'   c           	     óÚ  € \         P                  ! 4       V n        \        R 4      V n        \        R4      V n        RV P                  ,           R,           V P
                  ,           R,           V n        \        4       V n        V P                  \        RV P                  4       \        V P                  4       4      V n        \        V P                  P                  \        4      '       g   Q hV P                  P!                  R4      V n        V P"                  P%                  4        \'        4       pVP)                  RR^^R	V P                  P                  R
4       WP                  n        R# )ó   foobaró   eggspams   t1 s    foo
t2 s    egg
rY   ú.sshÚuserr1   rB   ú
/bin/shellN)r   ÚSSHPublicKeyDatabaseÚcheckerr   Úkey1Úkey2Úcontentr   r!   rG   r   r   ÚmktempÚpathÚ
isinstanceÚstrÚchildÚsshDirÚmakedirsr   rF   Ú_userdbrK   s   & r$   r%   ÚSSHPublicKeyDatabaseTests.setUp¥   s÷   € Ü×4Ò4Ó6ˆŒÜ 	Ó*ˆŒ	Ü 
Ó+ˆŒ	Ø §	¡	Õ)¨LÕ8¸4¿9¹9ÕDÀyÕPˆŒä“hˆŒØ�
‰
”4˜˜tŸ{™{Ô+ä˜TŸ[™[›]Ó+ˆŒ	Ü˜$Ÿ)™)Ÿ.™.¬#×.Ò.Ð.Ð.Ø—i‘i—o‘o fÓ-ˆŒØ�‰×ÑÔä“ˆØ�‰ØØØØØØ�I‰I�N‰NØô	
ð  &�‰Ör'   c                óþ   € V P                  V P                  .R7      pV P                  V^ ,          R,          \        4       V P                  V^ ,          R,          R4       V P                  \	        V4      ^4       R# )z:
L{SSHPublicKeyDatabase} is deprecated as of version 15.0
)ÚoffendingFunctionsÚcategoryÚmessagezÜtwisted.conch.checkers.SSHPublicKeyDatabase was deprecated in Twisted 15.0.0: Please use twisted.conch.checkers.SSHPublicKeyChecker, initialized with an instance of twisted.conch.checkers.UNIXAuthorizedKeysFiles instead.N)ÚflushWarningsr%   rH   ÚDeprecationWarningÚlen)r#   ÚwarningsShowns   & r$   Útest_deprecatedÚ)SSHPublicKeyDatabaseTests.test_deprecated¿   sp   € ð ×*Ñ*¸t¿z¹z¸lÐ*ÓKˆØ×Ñ˜ qÕ)¨*Õ5Ô7IÔJØ×ÑØ˜!Õ˜YÕ'ðFô	
ð 	×Ñœ˜]Ó+¨QÖ/r'   c                ó¬  € V P                   P                  V4      P                  V P                  4       \	        R R4      pRVn        V P                  V P                  P                  V4      4       RVn        V P                  V P                  P                  V4      4       RVn        V P                  V P                  P                  V4      4       R# )ó   useró   passwordr{   r|   s
   notallowedN)
rŠ   r‰   Ú
setContentr„   r   Úblobr-   r�   ÚcheckKeyr;   )r#   Úfilenamer~   s   && r$   Ú_testCheckKeyÚ'SSHPublicKeyDatabaseTests._testCheckKeyÏ   s—   € Ø�‰×Ñ˜(Ó#×.Ñ.¨t¯|©|Ô<Ü ¨Ó5ˆØˆŒ	Ø�‰˜Ÿ™×-Ñ-¨dÓ3Ô4ØˆŒ	Ø�‰˜Ÿ™×-Ñ-¨dÓ3Ô4Ø!ˆŒ	Ø×Ñ˜Ÿ™×.Ñ.¨tÓ4Ö5r'   c                óÀ   € V P                  R4       V P                  V P                  P                  . 4       V P                  V P                  P                  . 4       R# )z€
L{SSHPublicKeyDatabase.checkKey} should retrieve the content of the
authorized_keys file and check the keys against that file.
Úauthorized_keysN©rŸ   rH   r!   r^   r_   r"   s   &r$   Útest_checkKeyÚ'SSHPublicKeyDatabaseTests.test_checkKeyÙ   sG   € ð
 	×ÑÐ,Ô-Ø×Ñ˜Ÿ™×1Ñ1°2Ô6Ø×Ñ˜Ÿ™×1Ñ1°2Ö6r'   c                óÀ   € V P                  R4       V P                  V P                  P                  . 4       V P                  V P                  P                  . 4       R# )z�
L{SSHPublicKeyDatabase.checkKey} should retrieve the content of the
authorized_keys2 file and check the keys against that file.
Úauthorized_keys2Nr£   r"   s   &r$   Útest_checkKey2Ú(SSHPublicKeyDatabaseTests.test_checkKey2â   sG   € ð
 	×ÑÐ-Ô.Ø×Ñ˜Ÿ™×1Ñ1°2Ô6Ø×Ñ˜Ÿ™×1Ñ1°2Ö6r'   c                óä  aa€ V P                   P                  R4      oSP                  V P                  4       SP	                  ^ 4       V P                  SP                  R4       V P                  P                  oVV3R lpRV P                  n        RV P                  n	        V P                  V P                  RV4       V P                  \        RV P                  4       \        RR	4      pR
Vn        V P                  V P                  P!                  V4      4       V P#                  V P                  P$                  . RO4       V P#                  V P                  P&                  ^R.4       R# )z€
If the key file is readable, L{SSHPublicKeyDatabase.checkKey} should
switch its uid/gid to the ones of the authenticated user.
r¢   éÿ  c                 ó6   <€ SP                  R 4       S! V 4      # )r«   )Úchmod)rZ   ÚkeyFileÚsavedSeteuids   &€€r$   ÚseteuidÚ>SSHPublicKeyDatabaseTests.test_checkKeyAsRoot.<locals>.seteuidø   s   ø€ Ø�M‰M˜%Ô Ù Ó%Ð%r'   rW   rX   r°   rY   r™   rš   r{   N)é    é   r²   rW   )rŠ   r‰   r›   r„   r­   Ú
addCleanupr!   r°   rZ   r[   rG   r   r   rœ   r-   r�   r�   rH   r^   r_   )r#   r°   r~   r®   r¯   s   &  @@r$   Útest_checkKeyAsRootÚ-SSHPublicKeyDatabaseTests.test_checkKeyAsRootë   s  ù€ ð
 —+‘+×#Ñ#Ð$5Ó6ˆØ×Ñ˜4Ÿ<™<Ô(à�‰�eÔØ�‰˜Ÿ™ uÔ-à—{‘{×*Ñ*ˆö	&ð  ˆ�‰ÔØˆ�‰ÔØ�
‰
�4—;‘; 	¨7Ô3Ø�
‰
”4˜˜tŸ{™{Ô+Ü ¨Ó5ˆØˆŒ	Ø�‰˜Ÿ™×-Ñ-¨dÓ3Ô4Ø×Ñ˜Ÿ™×1Ñ1²?ÔCØ×Ñ˜Ÿ™×1Ñ1°A°t°9Ö=r'   c           	     óV  a € R pS P                  S P                  RV4       \        RR\        P                  R\
        P                  P                  \        P                  4      P                  R4      4      pS P                  P                  V4      pV 3R lpVP                  V4      # )zx
L{SSHPublicKeyDatabase.requestAvatarId} should return the avatar id
passed in if its C{_checkKey} method returns True.
c                 ó   € R # ©Trw   ©Úignoreds   &r$   Ú	_checkKeyÚASSHPublicKeyDatabaseTests.test_requestAvatarId.<locals>._checkKey  ó   € Ùr'   r�   ó   testó   ssh-rsaó   fooc                 ó,   <€ SP                  V R 4       R# ©r¿   N©rH   ©ÚavatarIdr#   s   &€r$   Ú_verifyÚ?SSHPublicKeyDatabaseTests.test_requestAvatarId.<locals>._verify  ó   ø€ Ø×Ñ˜X wÖ/r'   )rG   r�   r
   r   ÚpublicRSA_opensshr   ÚKeyÚ
fromStringÚprivateRSA_opensshÚsignÚrequestAvatarIdÚaddCallback)r#   r¼   ÚcredentialsÚdrÇ   s   f    r$   Útest_requestAvatarIdÚ.SSHPublicKeyDatabaseTests.test_requestAvatarId  s‰   ø€ ò	ð 	�
‰
�4—<‘< ¨YÔ7Ü#ØØÜ×%Ñ%ØÜ�H‰H×Ñ¤× :Ñ :Ó;×@Ñ@ÀÓHó
ˆð �L‰L×(Ñ(¨Ó5ˆõ	0ð �}‰}˜WÓ%Ð%r'   c                óÞ   € R pV P                  V P                  RV4       \        RR\        P                  RR4      pV P                  P                  V4      pV P                  V\        4      # )a   
L{SSHPublicKeyDatabase.requestAvatarId} should raise L{ValidPublicKey}
if the credentials represent a valid key without a signature.  This
tells the user that the key is valid for login, but does not actually
allow that user to do so without a signature.
c                 ó   € R # r¹   rw   rº   s   &r$   r¼   ÚQSSHPublicKeyDatabaseTests.test_requestAvatarIdWithoutSignature.<locals>._checkKey&  r¾   r'   r�   r¿   rÀ   N)rG   r�   r
   r   rÊ   rÏ   ÚassertFailurer   ©r#   r¼   rÑ   rÒ   s   &   r$   Ú$test_requestAvatarIdWithoutSignatureÚ>SSHPublicKeyDatabaseTests.test_requestAvatarIdWithoutSignature  sa   € ò	ð 	�
‰
�4—<‘< ¨YÔ7Ü#Ø�Z¤×!:Ñ!:¸DÀ$ó
ˆð �L‰L×(Ñ(¨Ó5ˆØ×!Ñ! !¤^Ó4Ð4r'   c                ó¤   € R pV P                  V P                  RV4       V P                  P                  R4      pV P                  V\        4      # )zm
If L{SSHPublicKeyDatabase.checkKey} returns False,
C{_cbRequestAvatarId} should raise L{UnauthorizedLogin}.
c                 ó   € R # ©Frw   rº   s   &r$   r¼   ÚKSSHPublicKeyDatabaseTests.test_requestAvatarIdInvalidKey.<locals>._checkKey6  ó   € Ùr'   r�   N)rG   r�   rÏ   rØ   r   )r#   r¼   rÒ   s   &  r$   Útest_requestAvatarIdInvalidKeyÚ8SSHPublicKeyDatabaseTests.test_requestAvatarIdInvalidKey0  sE   € ò	ð 	�
‰
�4—<‘< ¨YÔ7Ø�L‰L×(Ñ(¨Ó.ˆØ×!Ñ! !Ô%6Ó7Ð7r'   c           	     óR  € R pV P                  V P                  RV4       \        RR\        P                  R\
        P                  P                  \        P                  4      P                  R4      4      pV P                  P                  V4      pV P                  V\        4      # )z�
Valid keys with invalid signatures should cause
L{SSHPublicKeyDatabase.requestAvatarId} to return a {UnauthorizedLogin}
failure
c                 ó   € R # r¹   rw   rº   s   &r$   r¼   ÚQSSHPublicKeyDatabaseTests.test_requestAvatarIdInvalidSignature.<locals>._checkKeyD  r¾   r'   r�   r¿   rÀ   rÁ   )rG   r�   r
   r   rÊ   r   rË   rÌ   ÚprivateDSA_opensshrÎ   rÏ   rØ   r   rÙ   s   &   r$   Ú$test_requestAvatarIdInvalidSignatureÚ>SSHPublicKeyDatabaseTests.test_requestAvatarIdInvalidSignature=  s†   € ò	ð 	�
‰
�4—<‘< ¨YÔ7Ü#ØØÜ×%Ñ%ØÜ�H‰H×Ñ¤× :Ñ :Ó;×@Ñ@ÀÓHó
ˆð �L‰L×(Ñ(¨Ó5ˆØ×!Ñ! !Ô%6Ó7Ð7r'   c                óò   a € R pS P                  S P                  RV4       \        RRRRR4      pS P                  P                  V4      pV 3R lpVP	                  V4       S P                  V\        4      # )	zf
Exceptions raised while verifying the key should be normalized into an
C{UnauthorizedLogin} failure.
c                 ó   € R # r¹   rw   rº   s   &r$   r¼   ÚSSSHPublicKeyDatabaseTests.test_requestAvatarIdNormalizeException.<locals>._checkKeyX  r¾   r'   r�   r¿   Ns   blobs   sigDatas   sigc                 ó|   <€ SP                  \        P                  4      pSP                  \	        V4      ^4       V # )r³   )ÚflushLoggedErrorsr   ÚBadKeyErrorrH   r”   )ÚfailureÚerrorsr#   s   & €r$   Ú_verifyLoggedExceptionÚ`SSHPublicKeyDatabaseTests.test_requestAvatarIdNormalizeException.<locals>._verifyLoggedException_  s2   ø€ Ø×+Ñ+¬D×,<Ñ,<Ó=ˆFØ×ÑœS ›[¨!Ô,ØˆNr'   )rG   r�   r
   rÏ   Ú
addErrbackrØ   r   )r#   r¼   rÑ   rÒ   rñ   s   f    r$   Ú&test_requestAvatarIdNormalizeExceptionÚ@SSHPublicKeyDatabaseTests.test_requestAvatarIdNormalizeExceptionR  sl   ø€ ò	ð 	�
‰
�4—<‘< ¨YÔ7Ü# G¨T°7¸JÈÓOˆØ�L‰L×(Ñ(¨Ó5ˆõ	ð
 	
�‰Ð+Ô,Ø×!Ñ! !Ô%6Ó7Ð7r'   )r�   r„   r‚   rƒ   r!   r†   rŠ   N)re   rf   rg   rh   ri   ÚeuidSkiprk   rl   r%   r–   rŸ   r¤   r¨   rµ   rÓ   rÚ   rá   rç   rô   rm   rn   ro   s   @r$   rr   rr   ž   sZ   ø‡ € ñð ×%Ð%�~€D÷&ð &ò40ò 6ò7ò7ò>ò6&ò05ò$8ò8÷*8ð 8r'   rr   c                   óL   a € ] tR tRt o Rt]tR tR tR t	R t
R tR tR	tV tR
# )ÚSSHProtocolCheckerTestsih  z"
Tests for L{SSHProtocolChecker}.
c                ó\  € \         P                  ! 4       pV P                  VP                  . 4       VP	                  \         P
                  ! 4       4       V P                  VP                  \        .4       V P                  VP                   \        ,          \         P
                  4       R# )zh
L{SSHProcotolChecker.registerChecker} should add the given checker to
the list of registered checkers.
N)r   ÚSSHProtocolCheckerrH   ÚcredentialInterfacesÚregisterCheckerr€   r   ÚassertIsInstance©r#   r�   s   & r$   Útest_registerCheckerÚ,SSHProtocolCheckerTests.test_registerCheckero  s�   € ô
 ×-Ò-Ó/ˆØ×Ñ˜×5Ñ5°rÔ:Ø×ÑÜ×)Ò)Ó+ô	
ð 	×Ñ˜×5Ñ5¼Ð7GÔHØ×ÑØ×Ñœ^Õ,¬h×.KÑ.Kö	
r'   c                óf  € \         P                  ! 4       pV P                  VP                  . 4       VP	                  \         P
                  ! 4       \        4       V P                  VP                  \        .4       V P                  VP                   \        ,          \         P
                  4       R# )z±
If a specific interface is passed into
L{SSHProtocolChecker.registerChecker}, that interface should be
registered instead of what the checker specifies in
credentialIntefaces.
N)r   rú   rH   rû   rü   r€   r	   rý   rþ   s   & r$   Ú!test_registerCheckerWithInterfaceÚ9SSHProtocolCheckerTests.test_registerCheckerWithInterface~  s�   € ô ×-Ò-Ó/ˆØ×Ñ˜×5Ñ5°rÔ:Ø×Ñ¤× =Ò =Ó ?ÔARÔSØ×Ñ˜×5Ñ5Ô8IÐ7JÔKØ×ÑØ×ÑÔ.Õ/´×1NÑ1Nö	
r'   c                óì   a € \         P                  ! 4       p\        4       pVP                  RR4       VP	                  V4       VP                  \        RR4      4      pV 3R lpVP                  V4      # )zn
L{SSHProtocolChecker.requestAvatarId} should defer to one if its
registered checkers to authenticate a user.
r¿   c                 ó,   <€ SP                  V R 4       R# rÃ   rÄ   rÅ   s   &€r$   Ú	_callbackÚ?SSHProtocolCheckerTests.test_requestAvatarId.<locals>._callback˜  rÉ   r'   )r   rú   r   rF   rü   rÏ   r   rÐ   )r#   r�   ÚpasswordDatabaserÒ   r  s   f    r$   rÓ   Ú,SSHProtocolCheckerTests.test_requestAvatarId�  si   ø€ ô
 ×-Ò-Ó/ˆÜBÓDÐØ× Ñ  ¨'Ô2Ø×ÑÐ 0Ô1Ø×#Ñ#Ô$4°W¸gÓ$FÓGˆõ	0ð �}‰}˜YÓ'Ð'r'   c                ó  € \         P                  ! 4       pR pV P                  VRV4       \        4       pVP	                  RR4       VP                  V4       VP                  \        RR4      4      pV P                  V\        4      # )z¢
If the client indicates that it is never satisfied, by always returning
False from _areDone, then L{SSHProtocolChecker} should raise
L{NotEnoughAuthentication}.
c                 ó   € R # rÞ   rw   )rÆ   s   &r$   Ú_areDoneÚYSSHProtocolCheckerTests.test_requestAvatarIdWithNotEnoughAuthentication.<locals>._areDone¥  rà   r'   ÚareDoner¿   )
r   rú   rG   r   rF   rü   rÏ   r   rØ   r   )r#   r�   r  r  rÒ   s   &    r$   Ú/test_requestAvatarIdWithNotEnoughAuthenticationÚGSSHProtocolCheckerTests.test_requestAvatarIdWithNotEnoughAuthentication�  s}   € ô ×-Ò-Ó/ˆò	ð 	�
‰
�7˜I xÔ0äBÓDÐØ× Ñ  ¨'Ô2Ø×ÑÐ 0Ô1Ø×#Ñ#Ô$4°W¸gÓ$FÓGˆØ×!Ñ! !Ô%<Ó=Ð=r'   c                óŽ   € \         P                  ! 4       pVP                  \        RR4      4      pV P	                  V\
        4      # )z�
If the passed credentials aren't handled by any registered checker,
L{SSHProtocolChecker} should raise L{UnhandledCredentials}.
r¿   )r   rú   rÏ   r   rØ   r   )r#   r�   rÒ   s   &  r$   Ú%test_requestAvatarIdInvalidCredentialÚ=SSHProtocolCheckerTests.test_requestAvatarIdInvalidCredential°  s>   € ô
 ×-Ò-Ó/ˆØ×#Ñ#Ô$4°W¸gÓ$FÓGˆØ×!Ñ! !Ô%9Ó:Ð:r'   c                ól   € V P                  \        P                  ! 4       P                  R4      4       R# )zF
The default L{SSHProcotolChecker.areDone} should simply return True.
N)r-   r   rú   r  r"   s   &r$   Útest_areDoneÚ$SSHProtocolCheckerTests.test_areDone¹  s$   € ð 	�‰œ×3Ò3Ó5×=Ñ=¸dÓCÖDr'   rw   N)re   rf   rg   rh   ri   rk   rl   rÿ   r  rÓ   r  r  r  rm   rn   ro   s   @r$   rø   rø   h  s6   ø‡ € ñð €Dò
ò
ò(ò >ò&;÷Eð Er'   rø   c                   ó~   a € ] tR tRt o Rt];'       g    ]tV 3R lR ltR t	R t
R tR tR	 tR
 tR tR tRtV tR# )ÚUNIXPasswordDatabaseTestsiÀ  z$
Tests for L{UNIXPasswordDatabase}.
c                ó:   <€ V ^8„  d   QhRS[ S[,          RS[RR/# )ru   rÒ   Úusernamerv   N)r   Úbytes)r/   rp   s   "€r$   rx   Ú&UNIXPasswordDatabaseTests.__annotate__Ç  s&   ø€ ÷ <ñ <¡©¥ð <¹5ð <ÀTñ <r'   c                óH   € V P                  V P                  V4      V4       R# )zÈ
Assert that the L{Deferred} passed in is called back with the value
'username'.  This represents a valid login for this TestCase.

@param d: a L{Deferred} from an L{IChecker.requestAvatarId} method.
N)rH   ÚsuccessResultOf)r#   rÒ   r  s   &&&r$   ÚassertLoggedInÚ(UNIXPasswordDatabaseTests.assertLoggedInÇ  s   € ð 	×Ñ˜×-Ñ-¨aÓ0°(Ö;r'   c                ó†  € \         P                  ! 4       pR p\        4       pVP                  RV! RR4      ^^RRR4       VP                  RR^^R	R
R4       \	        4       pVP                  RR^^^^^^^4	       VP                  RV! RR4      ^^	^
^^^^4	       V P                  \         RV4       V P                  \         RV4       \        4       pV P                  \        RV4       RVn        RVn	        \        RR4      pV P                  VP                  V4      R4       V P                  VP                  . 4       V P                  VP                  . 4       RVn        V P                  VP                  V4      R4       V P                  VP                  ^ R.4       V P                  VP                  ^ R.4       R# )zi
L{UNIXPasswordDatabase} with no arguments has checks the C{pwd} database
and then the C{spwd} database.
c                 ón   € \         P                   ! W4      p\         P                   ! VR V,           4      pV# )z$1$)r,   )r  r1   r2   r3   s   &&  r$   r3   Ú?UNIXPasswordDatabaseTests.test_defaultCheckers.<locals>.crypted×  s)   € Ü—;’;˜xÓ2ˆDÜ—k’k (¨E°D­LÓ9ˆGØˆNr'   r@   r1   ÚfoorC   rD   rT   ÚxÚbarú/barr<   rE   rV   rY   rW   rX   ó   alicerš   ó   bobN)r   ÚUNIXPasswordDatabaser   rF   r   rG   r   r   rZ   r[   r   r  rÏ   rH   r^   r_   r  )r#   r�   r3   rE   rV   r!   Úcreds   &      r$   Útest_defaultCheckersÚ.UNIXPasswordDatabaseTests.test_defaultCheckersÐ  s‘  € ô
 ×/Ò/Ó1ˆò	ô
 ‹nˆØ�‰Ø‘W˜W jÓ1°1°a¸ÀÈ	ô	
ð 	�‰�E˜3  1 e¨V°YÔ?ÜÓˆØ�‰�W˜g q¨!¨Q°°1°a¸Ô;Ø�‰�U™G E¨:Ó6¸¸1¸bÀ"ÀbÈ"ÈbÔQà�
‰
”8˜U CÔ(Ø�
‰
”8˜V TÔ*ä“ˆØ�
‰
”4˜˜vÔ&àˆŒØˆŒä ¨+Ó6ˆØ×Ñ˜G×3Ñ3°DÓ9¸8ÔDØ×Ñ˜×,Ñ,¨bÔ1Ø×Ñ˜×,Ñ,¨bÔ1ØˆŒØ×Ñ˜G×3Ñ3°DÓ9¸6ÔBØ×Ñ˜×,Ñ,¨q°$¨iÔ8Ø×Ñ˜×,Ñ,¨q°$¨iÖ8r'   c                óF   € V P                  V\        P                  4       R# )a}  
Asserts that the L{Deferred} passed in is erred back with an
L{UnauthorizedLogin} L{Failure}.  This reprsents an invalid login for
this TestCase.

NOTE: To work, this method's return value must be returned from the
test method, or otherwise hooked up to the test machinery.

@param d: a L{Deferred} from an L{IChecker.requestAvatarId} method.
@type d: L{Deferred}
@rtype: L{None}
N)ÚfailureResultOfr   r   ©r#   rÒ   s   &&r$   ÚassertUnauthorizedLoginÚ1UNIXPasswordDatabaseTests.assertUnauthorizedLoginø  s   € ð 	×Ñ˜Q¤× :Ñ :Ö;r'   c           	     ó  € \         P                   ! RR4      p\        4       pVP                  RV^^RRR4       \        P                  ! VP
                  .4      pV P                  VP                  \        RR4      4      R4       R# )	zW
L{UNIXPasswordDatabase} takes a list of functions to check for UNIX
user information.
ÚsecretÚanybodyr$  r'  rD   s   anybodys   secretN)	r,   r   rF   r   r*  rJ   r  rÏ   r   )r#   r1   rL   r�   s   &   r$   Útest_passInCheckersÚ-UNIXPasswordDatabaseTests.test_passInCheckers  sp   € ô
 —;’;˜x¨Ó2ˆÜ“ˆØ�‰�y (¨A¨q°%¸ÀÔKÜ×/Ò/°·±Ð0AÓBˆØ×ÑØ×#Ñ#Ô$4°ZÀÓ$KÓLÈjö	
r'   c                óÈ   € R pR pV P                  \        RV4       \        P                  ! V.4      p\        RR4      pV P	                  VP                  V4      R4       R# )z½
If the encrypted password provided by the getpwnam function is valid
(verified by the L{verifyCryptedPassword} function), we callback the
C{requestAvatarId} L{Deferred} with the username.
c                 ó
   € W8H  # r    rw   ©r3   Úpws   &&r$   r.   ÚLUNIXPasswordDatabaseTests.test_verifyPassword.<locals>.verifyCryptedPassword  ó
   € Ø‘=Ð r'   c                 ó   € W .# r    rw   ©r  s   &r$   rJ   Ú?UNIXPasswordDatabaseTests.test_verifyPassword.<locals>.getpwnam  s   € ØÐ'Ð'r'   r.   ó   usernameN©rG   r   r*  r   r  rÏ   ©r#   r.   rJ   r�   Ú
credentials   &    r$   Útest_verifyPasswordÚ-UNIXPasswordDatabaseTests.test_verifyPassword  sY   € ò	!ò	(ð 	�
‰
”8Ð4Ð6KÔLÜ×/Ò/°°
Ó;ˆÜ% k°;Ó?ˆ
Ø×Ñ˜G×3Ñ3°JÓ?ÀÖMr'   c                ó’   € R p\         P                  ! V.4      p\        RR4      pV P                  VP	                  V4      4       R# )ze
If the getpwnam function raises a KeyError, the login fails with an
L{UnauthorizedLogin} exception.
c                 ó   € \        V 4      hr    )ÚKeyErrorr?  s   &r$   rJ   Ú?UNIXPasswordDatabaseTests.test_failOnKeyError.<locals>.getpwnam,  s   € Ü˜8Ó$Ð$r'   rA  rš   N)r   r*  r   r1  rÏ   )r#   rJ   r�   rD  s   &   r$   Útest_failOnKeyErrorÚ-UNIXPasswordDatabaseTests.test_failOnKeyError&  s@   € ò	%ô ×/Ò/°°
Ó;ˆÜ% k°;Ó?ˆ
Ø×$Ñ$ W×%<Ñ%<¸ZÓ%HÖIr'   c                óÆ   € R pR pV P                  \        RV4       \        P                  ! V.4      p\        RR4      pV P	                  VP                  V4      4       R# )z|
If the verifyCryptedPassword function doesn't verify the password, the
login fails with an L{UnauthorizedLogin} exception.
c                 ó   € R # rÞ   rw   r:  s   &&r$   r.   ÚOUNIXPasswordDatabaseTests.test_failOnBadPassword.<locals>.verifyCryptedPassword9  rà   r'   c                 ó
   € V R .# )rš   rw   r?  s   &r$   rJ   ÚBUNIXPasswordDatabaseTests.test_failOnBadPassword.<locals>.getpwnam<  s   € Ø˜kÐ*Ð*r'   r.   rA  rš   N)rG   r   r*  r   r1  rÏ   rC  s   &    r$   Útest_failOnBadPasswordÚ0UNIXPasswordDatabaseTests.test_failOnBadPassword3  sW   € ò	ò	+ð 	�
‰
”8Ð4Ð6KÔLÜ×/Ò/°°
Ó;ˆÜ% k°;Ó?ˆ
Ø×$Ñ$ W×%<Ñ%<¸ZÓ%HÖIr'   c                óÎ   € R pR pR pV P                  \        RV4       \        P                  ! W#.4      p\        RR4      pV P	                  VP                  V4      R4       R# )zí
UNIXPasswordDatabase.requestAvatarId loops through each getpwnam
function associated with it and returns a L{Deferred} which fires with
the result of the first one which returns a value other than None.
ones do not verify the password.
c                 ó
   € W8H  # r    rw   r:  s   &&r$   r.   ÚRUNIXPasswordDatabaseTests.test_loopThroughFunctions.<locals>.verifyCryptedPasswordL  r=  r'   c                 ó
   € V R .# )znot the passwordrw   r?  s   &r$   Ú	getpwnam1ÚFUNIXPasswordDatabaseTests.test_loopThroughFunctions.<locals>.getpwnam1O  s   € ØÐ0Ð1Ð1r'   c                 ó
   € V R .# )r1   rw   r?  s   &r$   Ú	getpwnam2ÚFUNIXPasswordDatabaseTests.test_loopThroughFunctions.<locals>.getpwnam2R  s   € Ø˜jÐ)Ð)r'   r.   rA  rš   NrB  )r#   r.   rX  r[  r�   rD  s   &     r$   Útest_loopThroughFunctionsÚ3UNIXPasswordDatabaseTests.test_loopThroughFunctionsD  s_   € ò	!ò	2ò	*ð 	�
‰
”8Ð4Ð6KÔLÜ×/Ò/°Ð0FÓGˆÜ% k°;Ó?ˆ
Ø×Ñ˜G×3Ñ3°JÓ?ÀÖMr'   c           	     ó$  € \        4       pVP                  RR^^RRR4       VP                  RR^^RRR4       VP                  RR^^RRR4       V P                  \        R	V4       \        P                  ! \        P
                  .4      p\        R
R4      pV P                  VP                  V4      4       \        RR4      pV P                  VP                  V4      4       \        RR4      pV P                  VP                  V4      4       R# )z�
If the password returned by any function is C{""}, C{"x"}, or C{"*"} it
is not compared against the supplied password.  Instead it is skipped.
r@   Ú r$  r&  rT   r%  ÚcarolÚ*rE   r(  r'   r)  ó   xs   caroló   *N)	r   rF   rG   r   r*  rI   r   r1  rÏ   )r#   rE   r�   r+  s   &   r$   Útest_failOnSpecialÚ,UNIXPasswordDatabaseTests.test_failOnSpecialZ  së   € ô
 ‹nˆØ�‰�G˜R  A r¨5°%Ô8Ø�‰�E˜3  1 b¨%°Ô7Ø�‰�G˜S ! Q¨¨E°5Ô9Ø�
‰
”8˜U CÔ(ä×/Ò/´×1GÑ1GÐ0HÓIˆÜ ¨#Ó.ˆØ×$Ñ$ W×%<Ñ%<¸TÓ%BÔCä ¨Ó-ˆØ×$Ñ$ W×%<Ñ%<¸TÓ%BÔCä ¨$Ó/ˆØ×$Ñ$ W×%<Ñ%<¸TÓ%BÖCr'   rw   N)re   rf   rg   rh   ri   rj   rk   rl   r  r,  r1  r6  rE  rK  rR  r]  re  rm   rn   ro   s   @r$   r  r  À  sW   ø‡ € ñð ×&Ð&˜€D÷<ð <ò&9òP<ò
òNò$JòJò"N÷,Dð Dr'   r  c                   ó:   a € ] tR tRt o Rt]tR tR tR t	Rt
V tR# )ÚAuthorizedKeyFileReaderTestsip  z-
Tests for L{checkers.readAuthorizedKeyFile}
c                ó†   € \        R4      p\        P                  ! VR 4      pV P                  RR.\	        V4      4       R# )zO
L{checkers.readAuthorizedKeyFile} does not attempt to turn comments
into keys
sE   # this comment is ignored
this is not
# this is again
and this is notc                 ó   € V # r    rw   ©r%  s   &r$   Ú<lambda>ÚCAuthorizedKeyFileReaderTests.test_ignoresComments.<locals>.<lambda>‚  s   € Á1r'   s   this is nots   and this is notN©r   r   ÚreadAuthorizedKeyFilerH   Úlist©r#   ÚfileobjÚresults   &  r$   Útest_ignoresCommentsÚ1AuthorizedKeyFileReaderTests.test_ignoresCommentsw  sA   € ô
 ðó
ˆô ×/Ò/°¹ÓEˆØ×Ñ˜.Ð*<Ð=¼tÀF»|ÖLr'   c                ó†   € \        R4      p\        P                  ! VR R7      pV P                  R.\	        V4      4       R# )z_
L{checkers.readAuthorizedKeyFile} ignores leading whitespace in
lines, as well as empty lines
sg   
                           # ignore
                           not ignored
                           c                 ó   € V # r    rw   rk  s   &r$   rl  ÚYAuthorizedKeyFileReaderTests.test_ignoresLeadingWhitespaceAndEmptyLines.<locals>.<lambda>�  s   € ÉAr'   ©ÚparseKeys   not ignoredNrn  rq  s   &  r$   Ú*test_ignoresLeadingWhitespaceAndEmptyLinesÚGAuthorizedKeyFileReaderTests.test_ignoresLeadingWhitespaceAndEmptyLines…  s>   € ô
 ðó
ˆô ×/Ò/°Á+ÔNˆØ×Ñ˜.Ð)¬4°«<Ö8r'   c                óˆ   € R p\        R4      p\        P                  ! W!R7      pV P                  R.\	        V4      4       R# )z§
L{checkers.readAuthorizedKeyFile} does not raise an exception
when a key fails to parse (raises a
L{twisted.conch.ssh.keys.BadKeyError}), but rather just keeps going
c                 ó`   € V P                  R 4      '       d   \        P                  ! R4      hV # )ó   fzfailed to parse)Ú
startswithr   rî   )Úlines   &r$   Ú
failOnSomeÚKAuthorizedKeyFileReaderTests.test_ignoresUnparsableKeys.<locals>.failOnSomeš  s(   € Ø�‰˜t×$Ò$Ü×&Ò&Ð'8Ó9Ð9ØˆKr'   s   failed key
good keyry  s   good keyNrn  )r#   r‚  rr  rs  s   &   r$   Útest_ignoresUnparsableKeysÚ7AuthorizedKeyFileReaderTests.test_ignoresUnparsableKeys“  s:   € ò	ô
 Ð1Ó2ˆÜ×/Ò/°ÔMˆØ×Ñ˜+˜¬¨V«Ö5r'   rw   N)re   rf   rg   rh   ri   rk   rl   rt  r{  r„  rm   rn   ro   s   @r$   rh  rh  p  s&   ø‡ € ñð €DòMò9÷6ð 6r'   rh  c                   ó:   a € ] tR tRt o Rt]tR tR tR t	Rt
V tR# )ÚInMemorySSHKeyDBTestsi¤  z(
Tests for L{checkers.InMemorySSHKeyDB}
c                ól   € \         P                  ! RR./4      p\        \         P                  V4       R# )zG
L{checkers.InMemorySSHKeyDB} implements
L{checkers.IAuthorizedKeysDB}
r(  s   keyN)r   ÚInMemorySSHKeyDBr   ÚIAuthorizedKeysDB©r#   Úkeydbs   & r$   Útest_implementsInterfaceÚ.InMemorySSHKeyDBTests.test_implementsInterface«  s+   € ô
 ×)Ò)¨8°f°XÐ*>Ó?ˆÜ”X×/Ñ/°Ö7r'   c                óŒ   € \         P                  ! RR./4      pV P                  . \        VP	                  R4      4      4       R# )z�
If the user is not in the mapping provided to
L{checkers.InMemorySSHKeyDB}, an empty iterator is returned
by L{checkers.InMemorySSHKeyDB.getAuthorizedKeys}
r(  s   keysr)  N©r   r‰  rH   rp  ÚgetAuthorizedKeysr‹  s   & r$   Útest_noKeysForUnauthorizedUserÚ4InMemorySSHKeyDBTests.test_noKeysForUnauthorizedUser³  s;   € ô ×)Ò)¨8°g°YÐ*?Ó@ˆØ×Ñ˜œT %×"9Ñ"9¸&Ó"AÓBÖCr'   c                ó’   € \         P                  ! RRR./4      pV P                  RR.\        VP	                  R4      4      4       R# )z¥
If the user is in the mapping provided to
L{checkers.InMemorySSHKeyDB}, an iterator with all the keys
is returned by L{checkers.InMemorySSHKeyDB.getAuthorizedKeys}
r(  ó   aó   bNr�  r‹  s   & r$   Útest_allKeysForAuthorizedUserÚ3InMemorySSHKeyDBTests.test_allKeysForAuthorizedUser¼  sA   € ô ×)Ò)¨8°d¸D°\Ð*BÓCˆØ×Ñ˜$ ˜¤t¨E×,CÑ,CÀHÓ,MÓ'NÖOr'   rw   N)re   rf   rg   rh   ri   rk   rl   r�  r’  r—  rm   rn   ro   s   @r$   r‡  r‡  ¤  s(   ø‡ € ñð €Dò8òD÷Pð Pr'   r‡  c                   óX   a € ] tR tRt o Rt]tV 3R lR ltR tR t	R t
R tR	 tR
tV tR# )ÚUNIXAuthorizedKeysFilesTestsiÆ  z0
Tests for L{checkers.UNIXAuthorizedKeysFiles}.
c                ó   <€ V ^8„  d   QhRR/# rt   rw   )r/   rp   s   "€r$   rx   Ú)UNIXAuthorizedKeysFilesTests.__annotate__Í  s   ø€ ÷ 1ñ 1�tñ 1r'   c           	     ó4  € \        V P                  4       4      V n        \        V P                  P                  \        4      '       g   Q hV P                  P                  4        \        4       V n        V P                  P                  R R^^RV P                  P                  R4       V P                  P                  R4      V n
        V P                  P                  4        V P                  P                  R4      pVP                  R4       RR.V n        R	# )
r@   r1   zalice lastnamer   r}   r¢   s   key 1
key 2s   key 1s   key 2N)r   r…   r†   r‡   rˆ   r‹   r   rL   rF   r‰   rŠ   r›   ÚexpectedKeys)r#   ÚauthorizedKeyss   & r$   r%   Ú"UNIXAuthorizedKeysFilesTests.setUpÍ  sÍ   € Ü˜TŸ[™[›]Ó+ˆŒ	Ü˜$Ÿ)™)Ÿ.™.¬#×.Ò.Ð.Ð.Ø�	‰	×ÑÔä"“nˆŒØ�‰×ÑØØØØØØ�I‰I�N‰NØô	
ð —i‘i—o‘o fÓ-ˆŒØ�‰×ÑÔØŸ™×*Ñ*Ð+<Ó=ˆØ×!Ñ! /Ô2à% xÐ0ˆÖr'   c                óz   € \         P                  ! V P                  4      p\        \         P                  V4       R# )zO
L{checkers.UNIXAuthorizedKeysFiles} implements
L{checkers.IAuthorizedKeysDB}.
N)r   ÚUNIXAuthorizedKeysFilesrL   r   rŠ  r‹  s   & r$   r�  Ú5UNIXAuthorizedKeysFilesTests.test_implementsInterfaceä  s(   € ô
 ×0Ò0°·±Ó=ˆÜ”X×/Ñ/°Ö7r'   c                ó    € \         P                  ! V P                  R R7      pV P                  . \	        VP                  R4      4      4       R# )z²
If the user is not in the user database provided to
L{checkers.UNIXAuthorizedKeysFiles}, an empty iterator is returned
by L{checkers.UNIXAuthorizedKeysFiles.getAuthorizedKeys}.
c                 ó   € V # r    rw   rk  s   &r$   rl  ÚMUNIXAuthorizedKeysFilesTests.test_noKeysForUnauthorizedUser.<locals>.<lambda>ò  ó   € ÑQRr'   ry  r)  N)r   r¢  rL   rH   rp  r‘  r‹  s   & r$   r’  Ú;UNIXAuthorizedKeysFilesTests.test_noKeysForUnauthorizedUserì  s:   € ô ×0Ò0°·±Á{ÔSˆØ×Ñ˜œT %×"9Ñ"9¸&Ó"AÓBÖCr'   c                ó  € V P                   P                  R4      P                  R4       \        P                  ! V P
                  R R7      pV P                  V P                  R.,           \        VP                  R4      4      4       R# )zö
If the user is in the user database provided to
L{checkers.UNIXAuthorizedKeysFiles}, an iterator with all the keys in
C{~/.ssh/authorized_keys} and C{~/.ssh/authorized_keys2} is returned
by L{checkers.UNIXAuthorizedKeysFiles.getAuthorizedKeys}.
r§   s   key 3c                 ó   € V # r    rw   rk  s   &r$   rl  Ú`UNIXAuthorizedKeysFilesTests.test_allKeysInAllAuthorizedFilesForAuthorizedUser.<locals>.<lambda>ý  r§  r'   ry  r(  N)
rŠ   r‰   r›   r   r¢  rL   rH   rž  rp  r‘  r‹  s   & r$   Ú1test_allKeysInAllAuthorizedFilesForAuthorizedUserÚNUNIXAuthorizedKeysFilesTests.test_allKeysInAllAuthorizedFilesForAuthorizedUserõ  sh   € ð 	�‰×ÑÐ,Ó-×8Ñ8¸ÔBÜ×0Ò0°·±Á{ÔSˆØ×ÑØ×Ñ  
Õ*¬D°×1HÑ1HÈÓ1RÓ,Sö	
r'   c                ó´   € \         P                  ! V P                  R R7      pV P                  V P                  \        VP                  R4      4      4       R# )z˜
L{checkers.UNIXAuthorizedKeysFiles.getAuthorizedKeys} returns only
the keys in C{~/.ssh/authorized_keys} and C{~/.ssh/authorized_keys2}
if they exist.
c                 ó   € V # r    rw   rk  s   &r$   rl  ÚJUNIXAuthorizedKeysFilesTests.test_ignoresNonexistantFile.<locals>.<lambda>  r§  r'   ry  r(  N)r   r¢  rL   rH   rž  rp  r‘  r‹  s   & r$   Útest_ignoresNonexistantFileÚ8UNIXAuthorizedKeysFilesTests.test_ignoresNonexistantFile  s@   € ô ×0Ò0°·±Á{ÔSˆØ×Ñ˜×*Ñ*¬D°×1HÑ1HÈÓ1RÓ,SÖTr'   c                ó  € V P                   P                  R4      P                  4        \        P                  ! V P
                  R R7      pV P                  V P                  \        VP                  R4      4      4       R# )zŸ
L{checkers.UNIXAuthorizedKeysFiles.getAuthorizedKeys} returns only
the keys in C{~/.ssh/authorized_keys} and C{~/.ssh/authorized_keys2}
if they are readable.
r§   c                 ó   € V # r    rw   rk  s   &r$   rl  ÚIUNIXAuthorizedKeysFilesTests.test_ignoresUnreadableFile.<locals>.<lambda>  r§  r'   ry  r(  N)
rŠ   r‰   r‹   r   r¢  rL   rH   rž  rp  r‘  r‹  s   & r$   Útest_ignoresUnreadableFileÚ7UNIXAuthorizedKeysFilesTests.test_ignoresUnreadableFile  s\   € ð 	�‰×ÑÐ,Ó-×6Ñ6Ô8Ü×0Ò0°·±Á{ÔSˆØ×Ñ˜×*Ñ*¬D°×1HÑ1HÈÓ1RÓ,SÖTr'   )rž  r†   rŠ   rL   N)re   rf   rg   rh   ri   rk   rl   r%   r�  r’  r¬  r±  r¶  rm   rn   ro   s   @r$   rš  rš  Æ  s=   ø‡ € ñð €D÷1ð 1ò.8òDò
òU÷Uð Ur'   rš  Ú_KeyDBr‘  c                   ó   € ] tR tRtRtRtR# )Ú_DummyExceptioni  z(
Fake exception to be used for testing.
rw   N)re   rf   rg   rh   ri   rm   rw   r'   r$   rº  rº    s   † ñó 	r'   rº  c                   óR   a € ] tR tRt o Rt]tR tR tR t	R t
R tR tR	 tR
tV tR# )ÚSSHPublicKeyCheckerTestsi!  z,
Tests for L{checkers.SSHPublicKeyChecker}.
c           	     ó*  € \        R R\        P                  R\        P                  P                  \        P                  4      P                  R4      4      V n        \        R 4      V n
        \        P                  ! V P                  4      V n        R# )r(  rÀ   rÁ   c                 ó^   € \         P                  P                  \        P                  4      .# r    )r   rË   rÌ   r   rÊ   )Ú_s   &r$   rl  Ú0SSHPublicKeyCheckerTests.setUp.<locals>.<lambda>0  s   € ¤t§x¡x×':Ñ':¼7×;TÑ;TÓ'UÑ&Vr'   N)r
   r   rÊ   r   rË   rÌ   rÍ   rÎ   rÑ   r¸  rŒ  r   ÚSSHPublicKeyCheckerr�   r"   s   &r$   r%   ÚSSHPublicKeyCheckerTests.setUp(  si   € Ü(ØØÜ×%Ñ%ØÜ�H‰H×Ñ¤× :Ñ :Ó;×@Ñ@ÀÓHó
ˆÔô ÑVÓWˆŒ
Ü×3Ò3°D·J±JÓ?ˆŽr'   c                óš   € RV P                   n        V P                  V P                  P	                  V P                   4      \
        4       R# )z…
Calling L{checkers.SSHPublicKeyChecker.requestAvatarId} with
credentials that do not have a signature fails with L{ValidPublicKey}.
N)rÑ   Ú	signaturer/  r�   rÏ   r   r"   s   &r$   Ú test_credentialsWithoutSignatureÚ9SSHPublicKeyCheckerTests.test_credentialsWithoutSignature3  s:   € ð
 &*ˆ×ÑÔ"Ø×ÑØ�L‰L×(Ñ(¨×)9Ñ)9Ó:¼Nö	
r'   c                ó®   € RV P                   n        V P                  V P                  P	                  V P                   4      \
        P                  4       R# )z~
Calling L{checkers.SSHPublicKeyChecker.requestAvatarId} with
credentials that have a bad key fails with L{keys.BadKeyError}.
r'   N)rÑ   rœ   r/  r�   rÏ   r   rî   r"   s   &r$   Útest_credentialsWithBadKeyÚ3SSHPublicKeyCheckerTests.test_credentialsWithBadKey=  s@   € ð
 !$ˆ×ÑÔØ×ÑØ�L‰L×(Ñ(¨×)9Ñ)9Ó:¼D×<LÑ<Lö	
r'   c                ó¶   € \         P                  V P                  n        V P	                  V P
                  P                  V P                  4      \        4       R# )z±
If L{checkers.IAuthorizedKeysDB.getAuthorizedKeys} returns no keys
that match the credentials,
L{checkers.SSHPublicKeyChecker.requestAvatarId} fails with
L{UnauthorizedLogin}.
N)r   ÚpublicDSA_opensshrÑ   rœ   r/  r�   rÏ   r   r"   s   &r$   Útest_credentialsNoMatchingKeyÚ6SSHPublicKeyCheckerTests.test_credentialsNoMatchingKeyG  sA   € ô !(× 9Ñ 9ˆ×ÑÔØ×ÑØ�L‰L×(Ñ(¨×)9Ñ)9Ó:Ô<Mö	
r'   c                ó  € \         P                  P                  \        P                  4      P                  R4      V P                  n        V P                  V P                  P                  V P                  4      \        4       R# )z‡
Calling L{checkers.SSHPublicKeyChecker.requestAvatarId} with
credentials that are incorrectly signed fails with
L{UnauthorizedLogin}.
rÁ   N)r   rË   rÌ   r   ræ   rÎ   rÑ   rÄ  r/  r�   rÏ   r   r"   s   &r$   Ú test_credentialsInvalidSignatureÚ9SSHPublicKeyCheckerTests.test_credentialsInvalidSignatureS  sa   € ô &*§X¡X×%8Ñ%8Ü×&Ñ&ó&
ç
‰$ˆv‹,ð 	×ÑÔ"ð 	×ÑØ�L‰L×(Ñ(¨×)9Ñ)9Ó:Ô<Mö	
r'   c                óê   € R pV P                  \        P                  RV4       V P                  V P                  P                  V P                  4      \        4       V P                  \        4       R# )z}
If L{keys.Key.verify} raises an exception,
L{checkers.SSHPublicKeyChecker.requestAvatarId} fails with
L{UnauthorizedLogin}.
c                  ó   € \        4       hr    )rº  )ÚargsÚkwargss   *,r$   ÚfailÚ?SSHPublicKeyCheckerTests.test_failureVerifyingKey.<locals>.failg  s   € Ü!Ó#Ð#r'   ÚverifyN)
rG   r   rË   r/  r�   rÏ   rÑ   r   rí   rº  )r#   rÕ  s   & r$   Útest_failureVerifyingKeyÚ1SSHPublicKeyCheckerTests.test_failureVerifyingKey`  sV   € ò	$ð 	�
‰
”4—8‘8˜X tÔ,à×ÑØ�L‰L×(Ñ(¨×)9Ñ)9Ó:Ô<Mô	
ð 	×ÑœÖ/r'   c                ó’   € V P                   P                  V P                  4      pV P                  RV P	                  V4      4       R# )z]
L{checker.SSHPublicKeyChecker.requestAvatarId}, if successful,
callbacks with the username.
r(  N)r�   rÏ   rÑ   rH   r  r0  s   & r$   Útest_usernameReturnedOnSuccessÚ7SSHPublicKeyCheckerTests.test_usernameReturnedOnSuccessq  s9   € ð
 �L‰L×(Ñ(¨×)9Ñ)9Ó:ˆØ×Ñ˜ 4×#7Ñ#7¸Ó#:Ö;r'   )r�   rÑ   rŒ  N)re   rf   rg   rh   ri   rk   rl   r%   rÅ  rÈ  rÌ  rÏ  rØ  rÛ  rm   rn   ro   s   @r$   r¼  r¼  !  s:   ø‡ € ñð €Dò	@ò
ò
ò

ò
ò0÷"<ð <r'   r¼  c                óV   € V ^8„  d   Qh/ ^ \         9   d   \        \        ,          ;R&   # )ru   rj   )Ú__conditional_annotations__r   rˆ   )r/   s   "r$   rx   rx      s"   € ÷ ñ ÷ Ò Œ8”C�=Ñ òr'   )ArÞ  ri   rY   Úbase64r   Úcollectionsr   Úior   Útypingr   r,   rj   ÚImportErrorÚzope.interface.verifyr   Útwisted.cred.checkersr   Útwisted.cred.credentialsr   r	   r
   r   Útwisted.cred.errorr   r   Útwisted.internet.deferr   Útwisted.pythonr   Útwisted.python.fakepwdr   r   Útwisted.python.filepathr   Útwisted.python.reflectr   Útwisted.test.test_processr   Útwisted.trial.unittestr   rk   Útwisted.conchr   Útwisted.conch.errorr   r   Útwisted.conch.sshr   Útwisted.conch.testr   Úgetattrrö   r   rr   rø   r  rh  r‡  rš  r¸  Ú	Exceptionrº  r¼  rx   )rÞ  s   @r$   Ú<module>rõ     sC  øðöó
 
Ý Ý "Ý Ý ã ðÛð €Iå .å I÷ó ÷ GÝ +Ý ß ?Ý ,Ý 0Ý ,Ý +á�× Ò Ø€NÝ&ßKÝ&Þ*à5€Ná
ˆ2ˆy˜$ÓÒ+Ø�HàA€Hôc7�(ô c7ôLG8 ô G8ôTUE˜hô UEôpmD ô mDô`16 8ô 16ôhP˜Hô PôDMU 8ô MUñ` 
�HÐ2Ð3Ó	4€ô	�iô 	ôV<˜xö V<øð_ ô 2Ø1ƒIð2ús   ªD) Ä)	D6Ä5D6