+
    üÐj¹ƒ  ã                   óH  a € R0 t:0 t R t^ RIHt ^ RIHt ^ RIHt ^ RIH	t	H
t
 ^ RIHt ^ RIHtHtHt ^ RIHt ^ RIHt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t!] ^ k ]! R4      '       d   ^ RI"H#t# ^ RI$H!t!H%t%H&t& ^ RI'H(t( ^ RI)H*t* M ! R R4      t% ! R R4      t& ! R R]&PV                  4      t, ! R R]&PV                  4      t- ! R R]&PV                  4      t. ! R R]%P^                  4      t0]! ]4       ! R  R!4      4       t1]! ]4       ! R" R#4      4       t2]! ]4       ! R$ R%4      4       t3]! ]4       ! R& R'4      4       t4 ! R( R)] Pj                  4      t6 ! R* R+] Pj                  4      t7 ! R, R-] Pj                  4      t8 ! R. R/] Pj                  4      t9R# )1zT
Tests for the implementation of the ssh-userauth service.

Maintainer: Paul Swartz
)Ú
ModuleType)ÚOptional)Úimplementer)Ú
ConchErrorÚValidPublicKey)ÚICredentialsChecker)Ú
IAnonymousÚISSHPrivateKeyÚIUsernamePassword)ÚUnauthorizedLogin)ÚIRealmÚPortal)ÚdeferÚtask©ÚDeferred)Úloopback)ÚrequireModule)ÚunittestNÚcryptography)ÚSSHProtocolChecker)ÚkeysÚ	transportÚuserauth)ÚNS)Úkeydatac                   ó*   € ] tR t^"t ! R R4      tRtR# )r   c                   ó   € ] tR t^#tRtRtR# )Útransport.SSHTransportBaseú9
A stub class so that later class definitions won't die.
© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r    ó    ÚB/usr/lib/python3/dist-packages/twisted/conch/test/test_userauth.pyÚSSHTransportBaser   #   ó   † õr(   r*   r    N)r"   r#   r$   r%   r*   r'   r    r(   r)   r   r   "   ó   † ÷	õ 	r(   r   c                   ó*   € ] tR t^(t ! R R4      tRtR# )r   c                   ó   € ] tR t^)tRtRtR# )Úuserauth.SSHUserAuthClientr   r    Nr!   r    r(   r)   ÚSSHUserAuthClientr/   )   r+   r(   r0   r    N)r"   r#   r$   r%   r0   r'   r    r(   r)   r   r   (   r,   r(   r   c                   ó@   a € ] tR t^/t o RtR tR tRR ltR tRt	V t
R# )	ÚClientUserAuthz
A mock user auth client.
c                ó  € V P                   '       d.   \        P                  P                  \        P
                  4      # \        P                  ! \        P                  P                  \        P                  4      4      # )zx
If this is the first time we've been called, return a blob for
the DSA key.  Otherwise, return a blob
for the RSA key.
)	ÚlastPublicKeyr   ÚKeyÚ
fromStringr   ÚpublicRSA_opensshr   ÚsucceedÚpublicDSA_openssh©Úselfs   &r)   ÚgetPublicKeyÚClientUserAuth.getPublicKey4   sO   € ð ××ÐÜ—8‘8×&Ñ&¤w×'@Ñ'@ÓAÐAä—=’=¤§¡×!4Ñ!4´W×5NÑ5NÓ!OÓPÐPr(   c                ó„   € \         P                  ! \        P                  P	                  \
        P                  4      4      # )z0
Return the private key object for the RSA key.
)r   r8   r   r5   r6   r   ÚprivateRSA_opensshr:   s   &r)   ÚgetPrivateKeyÚClientUserAuth.getPrivateKey?   s(   € ô �}Š}œTŸX™X×0Ñ0´×1KÑ1KÓLÓMÐMr(   Nc                ó.   € \         P                  ! R4      # )z
Return 'foo' as the password.
ó   foo©r   r8   )r;   Úprompts   &&r)   ÚgetPasswordÚClientUserAuth.getPasswordE   s   € ô �}Š}˜VÓ$Ð$r(   c                ó.   € \         P                  ! R4      # )z.
Return 'foo' as the answer to two questions.
)ÚfoorI   rD   )r;   ÚnameÚinformationÚanswerss   &&&&r)   ÚgetGenericAnswersÚ ClientUserAuth.getGenericAnswersK   s   € ô �}Š}˜^Ó,Ð,r(   r    ©N)r"   r#   r$   r%   r&   r<   r@   rF   rM   r'   Ú__classdictcell__©Ú__classdict__s   @r)   r2   r2   /   s%   ø‡ € ñò	QòNô%÷-ð -r(   r2   c                   ó0   a € ] tR t^Rt o RtR tR tRtV tR# )ÚOldClientAuthzr
The old SSHUserAuthClient returned a cryptography key object from
getPrivateKey() and a string from getPublicKey
c                ó˜   € \         P                  ! \        P                  P	                  \
        P                  4      P                  4      # rO   )r   r8   r   r5   r6   r   r?   Ú	keyObjectr:   s   &r)   r@   ÚOldClientAuth.getPrivateKeyX   s,   € Ü�}Š}œTŸX™X×0Ñ0´×1KÑ1KÓL×VÑVÓWÐWr(   c                óx   € \         P                  P                  \        P                  4      P                  4       # rO   )r   r5   r6   r   r7   Úblobr:   s   &r)   r<   ÚOldClientAuth.getPublicKey[   s&   € Ü�x‰x×"Ñ"¤7×#<Ñ#<Ó=×BÑBÓDÐDr(   r    N©	r"   r#   r$   r%   r&   r@   r<   r'   rP   rQ   s   @r)   rT   rT   R   s   ø‡ € ñò
X÷Eð Er(   rT   c                   ó0   a € ] tR t^_t o RtR tR tRtV tR# )ÚClientAuthWithoutPrivateKeyzH
This client doesn't have a private key, but it does have a public key.
c                ó   € R # rO   r    r:   s   &r)   r@   Ú)ClientAuthWithoutPrivateKey.getPrivateKeyd   s   € Ùr(   c                ó\   € \         P                  P                  \        P                  4      # rO   )r   r5   r6   r   r7   r:   s   &r)   r<   Ú(ClientAuthWithoutPrivateKey.getPublicKeyg   s   € Ü�x‰x×"Ñ"¤7×#<Ñ#<Ó=Ð=r(   r    Nr[   rQ   s   @r)   r]   r]   _   s   ø‡ € ñò÷>ð >r(   r]   c                   ód   a € ] tR t^kt o Rt ! R R4      t ! R R4      tR tR tR t	R	 t
R
tV tR# )ÚFakeTransporta/  
L{userauth.SSHUserAuthServer} expects an SSH transport which has a factory
attribute which has a portal attribute. Because the portal is important for
testing authentication, we need to be able to provide an interesting portal
object to the L{SSHUserAuthServer}.

In addition, we want to be able to capture any packets sent over the
transport.

@ivar packets: a list of 2-tuples: (messageType, data).  Each 2-tuple is
    a sent packet.
@type packets: C{list}
@param lostConnecion: True if loseConnection has been called on us.
@type lostConnection: L{bool}
c                   ó.   a € ] tR t^|t o RtRtR tRtV tR# )ÚFakeTransport.ServicezG
A mock service, representing the other service offered by the server.
ó   nancyc                ó   € R # rO   r    r:   s   &r)   ÚserviceStartedÚ$FakeTransport.Service.serviceStartedƒ   s   € Ùr(   r    N)	r"   r#   r$   r%   r&   rJ   rh   r'   rP   rQ   s   @r)   ÚServicere   |   s   ø‡ € ñ	ð ˆ÷	ð 	r(   rj   c                   ó*   a € ] tR t^†t o RtR tRtV tR# )ÚFakeTransport.FactoryzO
A mock factory, representing the factory that spawned this user auth
service.
c                ó4   € VR8X  d   \         P                  # R# )z
Return our fake service.
ó   noneN)rc   rj   )r;   r   Úservices   &&&r)   Ú
getServiceÚ FakeTransport.Factory.getServiceŒ   s   € ð ˜'Ô!Ü$×,Ñ,Ð,ñ "r(   r    N)r"   r#   r$   r%   r&   rp   r'   rP   rQ   s   @r)   ÚFactoryrl   †   s   ø‡ € ñ	÷
	-ð 	-r(   rr   c                óx   € V P                  4       V n        WP                  n        R V n        W n        . V n        R# )FN)rr   ÚfactoryÚportalÚlostConnectionr   Úpackets)r;   ru   s   &&r)   Ú__init__ÚFakeTransport.__init__“   s-   € Ø—|‘|“~ˆŒØ$�‰ÔØ#ˆÔØŒØˆŽr(   c                ó>   € V P                   P                  W34       R# )z(
Record the packet sent by the service.
N)rw   Úappend)r;   ÚmessageTypeÚmessages   &&&r)   Ú
sendPacketÚFakeTransport.sendPacketš   s   € ð 	�‰×Ñ˜[Ð2Ö3r(   c                ó   € R# )z›
Pretend that this transport encrypts traffic in both directions. The
SSHUserAuthServer disables password authentication if the transport
isn't encrypted.
Tr    )r;   Ú	directions   &&r)   ÚisEncryptedÚFakeTransport.isEncrypted    s   € ñ r(   c                ó   € R V n         R# )TN)rv   r:   s   &r)   ÚloseConnectionÚFakeTransport.loseConnection¨   s
   € Ø"ˆÖr(   )rt   rv   rw   r   N)r"   r#   r$   r%   r&   rj   rr   rx   r~   r‚   r…   r'   rP   rQ   s   @r)   rc   rc   k   s7   ø‡ € ñ÷ ñ ÷-ñ -òò4ò÷#ð #r(   rc   c                   ó*   a € ] tR t^¬t o RtR tRtV tR# )ÚRealmz¯
A mock realm for testing L{userauth.SSHUserAuthServer}.

This realm is not actually used in the course of testing, so it returns the
simplest thing that could possibly work.
c                óD   € \         P                  ! V^ ,          RR 34      # )é    Nc                  ó   € R # rO   r    r    r(   r)   Ú<lambda>Ú%Realm.requestAvatar.<locals>.<lambda>¶   s   € ¹4r(   rD   )r;   ÚavatarIdÚmindÚ
interfacess   &&&*r)   ÚrequestAvatarÚRealm.requestAvatarµ   s   € Ü�}Š}˜j¨�m¨T±<Ð@ÓAÐAr(   r    N)r"   r#   r$   r%   r&   r‘   r'   rP   rQ   s   @r)   rˆ   rˆ   ¬   s   ø‡ € ñ÷Bð Br(   rˆ   c                   ó0   a € ] tR t^¹t o Rt]3tR tRtV t	R# )ÚPasswordCheckerz‚
A very simple username/password checker which authenticates anyone whose
password matches their username and rejects all others.
c                ó¶   € VP                   VP                  8X  d!   \        P                  ! VP                   4      # \        P                  ! \        R 4      4      # )zInvalid username/password pair)ÚusernameÚpasswordr   r8   Úfailr   )r;   Úcredss   &&r)   ÚrequestAvatarIdÚPasswordChecker.requestAvatarIdÂ   s;   € Ø�>‰>˜UŸ^™^Ô+Ü—=’= §¡Ó0Ð0Ü�zŠzÔ+Ð,LÓMÓNÐNr(   r    N)
r"   r#   r$   r%   r&   r
   ÚcredentialInterfacesrš   r'   rP   rQ   s   @r)   r”   r”   ¹   s!   ø‡ € ñð
 .Ð/Ð÷Oð Or(   r”   c                   ó0   a € ] tR t^Èt o Rt]3tR tRtV t	R# )ÚPrivateKeyCheckerz‰
A very simple public key checker which authenticates anyone whose
public/private keypair is the same keydata.public/privateRSA_openssh.
c                ó²  € VP                   \        P                  P                  \        P
                  4      P                  4       8X  d…   VP                  em   \        P                  P                  VP                   4      pVP                  VP                  VP                  4      '       d   VP                  #  \        4       h\        4       h\        4       hrO   )rY   r   r5   r6   r   r7   Ú	signatureÚverifyÚsigDatar–   r   r   )r;   r™   Úobjs   && r)   rš   Ú!PrivateKeyChecker.requestAvatarIdÑ   s•   € Ø�:‰:œŸ™×,Ñ,¬W×-FÑ-FÓG×LÑLÓNÔNØ�‰Ò*Ü—h‘h×)Ñ)¨%¯*©*Ó5�Ø—:‘:˜eŸo™o¨u¯}©}×=Ò=Ø Ÿ>™>Ð)ð >ô  Ó!Ð!ô %Ó&Ð&ÜÓ!Ð!r(   r    N)
r"   r#   r$   r%   r&   r	   rœ   rš   r'   rP   rQ   s   @r)   rž   rž   È   s   ø‡ € ñð
 +Ð,Ð÷"ð "r(   rž   c                   ó0   a € ] tR t^Üt o Rt]3tR tRtV t	R# )ÚAnonymousCheckerzA
A simple checker which isn't supported by L{SSHUserAuthServer}.
c                ó   € R # rO   r    )r;   Úcredentialss   &&r)   rš   Ú AnonymousChecker.requestAvatarIdä   s   € ár(   r    N)
r"   r#   r$   r%   r&   r   rœ   rš   r'   rP   rQ   s   @r)   r¦   r¦   Ü   s   ø‡ € ñð '˜=Ð÷ð r(   r¦   c                   óÌ   a € ] tR t^ét o Rt]f   RtV 3R lR ltR 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R tR tR tR tV 3R lR ltR tRtV tR# )ÚSSHUserAuthServerTestsz
Tests for SSHUserAuthServer.
Núcannot run without cryptographyc                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnNr    )ÚformatrR   s   "€r)   Ú__annotate__Ú#SSHUserAuthServerTests.__annotate__ñ   s   ø€ ÷ 8ñ 8�tñ 8r(   c                óÜ  € \        4       V n        \        V P                  4      V n        V P                  P	                  \        4       4       V P                  P	                  \        4       4       \        P                  ! 4       V n	        \        V P                  4      V P                  n        V P                  P                  4        V P                  P                  P                  4        R # rO   )rˆ   Úrealmr   ru   ÚregisterCheckerr”   rž   r   ÚSSHUserAuthServerÚ
authServerrc   r   rh   ÚsupportedAuthenticationsÚsortr:   s   &r)   ÚsetUpÚSSHUserAuthServerTests.setUpñ   s‘   € Ü“WˆŒ
Ü˜TŸZ™ZÓ(ˆŒØ�‰×#Ñ#¤OÓ$5Ô6Ø�‰×#Ñ#Ô$5Ó$7Ô8Ü"×4Ò4Ó6ˆŒÜ$1°$·+±+Ó$>ˆ�‰Ô!Ø�‰×&Ñ&Ô(Ø�‰×0Ñ0×5Ñ5Ö7r(   c                óH   € V P                   P                  4        R V n         R # rO   )r¸   ÚserviceStoppedr:   s   &r)   ÚtearDownÚSSHUserAuthServerTests.tearDownü   ó   € Ø�‰×&Ñ&Ô(ØˆŽr(   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r¯   Úignoredr°   N)Úobject)r±   rR   s   "€r)   r²   r³      s   ø€ ÷ 	
ñ 	
¡Fð 	
¨tñ 	
r(   c                ó  € \        V P                  P                  \        4      '       g   Q hV P                  P                  P                  R,          pV P                  V\        P                  \        R4      R,           34       R# )z+
Check that the authentication has failed.
s   password,publickeyó    Néÿÿÿÿ)	Ú
isinstancer¸   r   rc   rw   ÚassertEqualr   ÚMSG_USERAUTH_FAILUREr   )r;   rÃ   Ú
lastPackets   && r)   Ú_checkFailedÚ#SSHUserAuthServerTests._checkFailed   se   € ô ˜$Ÿ/™/×3Ñ3´]×CÒCÐCÐCØ—_‘_×.Ñ.×6Ñ6°rÕ:ˆ
Ø×ÑØÜ×*Ñ*¬BÐ/DÓ,EÈÕ,OÐPö	
r(   c                óÀ   € V P                   P                  \        R4      \        R4      ,           \        R4      ,           4      pVP                  V P                  4      # )z£
A client may request a list of authentication 'method name' values
that may continue by using the "none" authentication 'method name'.

See RFC 4252 Section 5.2.
rC   s   servicern   )r¸   Ússh_USERAUTH_REQUESTr   ÚaddCallbackrÌ   )r;   Úds   & r)   Útest_noneAuthenticationÚ.SSHUserAuthServerTests.test_noneAuthentication  sH   € ð �O‰O×0Ñ0Üˆv‹Jœ˜J›Õ'¬"¨W«+Õ5ó
ˆð �}‰}˜T×.Ñ.Ó/Ð/r(   c           	     óÜ   a € RP                  \        R4      \        R4      \        R4      R\        R4      .4      pS P                  P                  V4      pV 3R lpVP	                  V4      # )zµ
When provided with correct password authentication information, the
server should respond by sending a MSG_USERAUTH_SUCCESS message with
no other data.

See RFC 4252, Section 5.1.
r(   rC   rn   ó   passwordrÆ   c                 óŠ   <€ SP                  SP                  P                  P                  \        P
                  R 3.4       R# ©r(   N©rÉ   r¸   r   rw   r   ÚMSG_USERAUTH_SUCCESS©rÃ   r;   s   &€r)   ÚcheckÚKSSHUserAuthServerTests.test_successfulPasswordAuthentication.<locals>.check"  ó5   ø€ Ø×ÑØ—‘×)Ñ)×1Ñ1Ü×/Ñ/°Ð5Ð6ör(   )Újoinr   r¸   rÏ   rÐ   )r;   ÚpacketrÑ   rÛ   s   f   r)   Ú%test_successfulPasswordAuthenticationÚ<SSHUserAuthServerTests.test_successfulPasswordAuthentication  sX   ø€ ð —‘œ2˜f›:¤r¨'£{´B°{³OÀUÌBÈvËJÐWÓXˆØ�O‰O×0Ñ0°Ó8ˆõ	ð �}‰}˜UÓ#Ð#r(   c           	     óÔ  € RP                  \        R4      \        R4      \        R4      R\        R4      .4      p\        P                  ! 4       V P                  n        V P                  P                  V4      pV P                  V P                  P                  P                  . 4       V P                  P
                  P                  ^4       VP                  V P                  4      # )a  
When provided with invalid authentication details, the server should
respond by sending a MSG_USERAUTH_FAILURE message which states whether
the authentication was partially successful, and provides other, open
options for authentication.

See RFC 4252, Section 5.1.
r(   rC   rn   rÕ   rÆ   ó   bar)rÞ   r   r   ÚClockr¸   ÚclockrÏ   rÉ   r   rw   ÚadvancerÐ   rÌ   ©r;   rß   rÑ   s   &  r)   Ú!test_failedPasswordAuthenticationÚ8SSHUserAuthServerTests.test_failedPasswordAuthentication*  s    € ð —‘œ2˜f›:¤r¨'£{´B°{³OÀUÌBÈvËJÐWÓXˆÜ $§
¢
£ˆ�‰ÔØ�O‰O×0Ñ0°Ó8ˆØ×Ñ˜Ÿ™×2Ñ2×:Ñ:¸BÔ?Ø�‰×Ñ×%Ñ% aÔ(Ø�}‰}˜T×.Ñ.Ó/Ð/r(   c                óÒ  a € \         P                  P                  \        P                  4      P                  4       p\         P                  P                  \        P                  4      p\        R4      \        R4      ,           \        R4      ,           R,           \        VP                  4       4      ,           \        V4      ,           pRS P                  P                  n        VP                  \        R4      \        \        P                  34      ,           V,           4      pV\        V4      ,          pS P                  P!                  V4      pV 3R lpVP#                  V4      # )z>
Test that private key authentication completes successfully,
rC   rn   ó	   publickeyó   ÿó   testc                 óŠ   <€ SP                  SP                  P                  P                  \        P
                  R 3.4       R# r×   rØ   rÚ   s   &€r)   rÛ   ÚMSSHUserAuthServerTests.test_successfulPrivateKeyAuthentication.<locals>.checkP  rÝ   r(   )r   r5   r6   r   r7   rY   r?   r   ÚsshTyper¸   r   Ú	sessionIDÚsignÚbytesr   ÚMSG_USERAUTH_REQUESTrÏ   rÐ   )r;   rY   r£   rß   r    rÑ   rÛ   s   f      r)   Ú'test_successfulPrivateKeyAuthenticationÚ>SSHUserAuthServerTests.test_successfulPrivateKeyAuthentication;  s  ø€ ô �x‰x×"Ñ"¤7×#<Ñ#<Ó=×BÑBÓDˆÜ�h‰h×!Ñ!¤'×"<Ñ"<Ó=ˆäˆv‹JÜ�‹kõä�Óõð õô �—‘“Óõ	 ô
 �‹hõð 	ð /6ˆ�‰×!Ñ!Ô+Ø—H‘HÜˆw‹Kœ%¤×!>Ñ!>Ð @ÓAÕAÀFÕJó
ˆ	ð 	”"�Y“-ÕˆØ�O‰O×0Ñ0°Ó8ˆõ	ð �}‰}˜UÓ#Ð#r(   c                óÌ  a€ \         P                  ! 4       oR pR pV3R lpV P                  V P                  RV4       V P                  V P                  RV4       V P                  V P                  RV4       \	        R4      \	        R4      ,           \	        R	4      ,           \	        R
4      ,           pV P                  P                  V4       V P                  S\        4      # )zs
ssh_USERAUTH_REQUEST should raise a ConchError if tryAuth returns
None. Added to catch a bug noticed by pyflakes.
c                 ó(   € V P                  R 4       R# )z&request should have raised ConochErrorN)r˜   )r;   rÃ   s   &&r)   ÚmockCbFinishedAuthÚOSSHUserAuthServerTests.test_requestRaisesConchError.<locals>.mockCbFinishedAuth_  s   € Ø�I‰IÐ>Ö?r(   c                 ó   € R # rO   r    )ÚkindÚuserÚdatas   &&&r)   ÚmockTryAuthÚHSSHUserAuthServerTests.test_requestRaisesConchError.<locals>.mockTryAuthb  ó   € Ùr(   c                 ó>   <€ SP                  V P                  4       R # rO   )ÚerrbackÚvalue)ÚreasonrÑ   s   &€r)   ÚmockEbBadAuthÚJSSHUserAuthServerTests.test_requestRaisesConchError.<locals>.mockEbBadAuthe  s   ø€ Ø�I‰I�f—l‘lÖ#r(   ÚtryAuthÚ_cbFinishedAuthÚ
_ebBadAuths   userrn   s
   public-keys   data)r   r   Úpatchr¸   r   rÏ   ÚassertFailurer   )r;   rù   rÿ   r  rß   rÑ   s   &    @r)   Útest_requestRaisesConchErrorÚ3SSHUserAuthServerTests.test_requestRaisesConchErrorX  s­   ø€ ô
 �NŠNÓˆò	@ò	õ	$ð 	�
‰
�4—?‘? I¨{Ô;Ø�
‰
�4—?‘?Ð$5Ð7IÔJØ�
‰
�4—?‘? L°-Ô@ä�G“œr '›{Õ*¬R°Ó->Õ>ÄÀGÃÕLˆð 	�‰×,Ñ,¨VÔ4Ø×!Ñ! !¤ZÓ0Ð0r(   c                ó†  a a€ \         P                  P                  \        P                  4      P                  4       o\        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           \        S4      ,           pS P                  P                  V4      pVV 3R lpVP                  V4      # )z0
Test that verifying a valid private key works.
rC   rn   rë   rÆ   ó   ssh-rsac                 ó¼   <€ SP                  SP                  P                  P                  \        P
                  \        R 4      \        S4      ,           3.4       R# )r  N)rÉ   r¸   r   rw   r   ÚMSG_USERAUTH_PK_OKr   )rÃ   rY   r;   s   &€€r)   rÛ   Ú@SSHUserAuthServerTests.test_verifyValidPrivateKey.<locals>.check�  sB   ø€ Ø×ÑØ—‘×)Ñ)×1Ñ1Ü×-Ñ-¬r°*«~ÄÀ4ÃÕ/HÐIÐJör(   )
r   r5   r6   r   r7   rY   r   r¸   rÏ   rÐ   )r;   rß   rÑ   rÛ   rY   s   f   @r)   Útest_verifyValidPrivateKeyÚ1SSHUserAuthServerTests.test_verifyValidPrivateKeyr  sŸ   ù€ ô �x‰x×"Ñ"¤7×#<Ñ#<Ó=×BÑBÓDˆäˆv‹JÜ�‹kõä�Óõð õô �‹nõ	ô
 �‹hõð 	ð �O‰O×0Ñ0°Ó8ˆö	ð �}‰}˜UÓ#Ð#r(   c                óˆ  € \         P                  P                  \        P                  4      P                  4       p\        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           \        V4      ,           pV P                  P                  V4      pVP                  V P                  4      # )úL
Test that private key authentication fails when the public key
is invalid.
rC   rn   rë   rÆ   s   ssh-dsa©r   r5   r6   r   r9   rY   r   r¸   rÏ   rÐ   rÌ   ©r;   rY   rß   rÑ   s   &   r)   Ú3test_failedPrivateKeyAuthenticationWithoutSignatureÚJSSHUserAuthServerTests.test_failedPrivateKeyAuthenticationWithoutSignature‰  s�   € ô
 �x‰x×"Ñ"¤7×#<Ñ#<Ó=×BÑBÓDˆäˆv‹JÜ�‹kõä�Óõð õô �‹nõ	ô
 �‹hõð 	ð �O‰O×0Ñ0°Ó8ˆØ�}‰}˜T×.Ñ.Ó/Ð/r(   c                óV  € \         P                  P                  \        P                  4      P                  4       p\         P                  P                  \        P                  4      p\        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           \        V4      ,           \        VP                  V4      4      ,           pRV P                  P                  n        V P                  P                  V4      pVP                  V P                  4      # )r  rC   rn   rë   rì   r  rí   )r   r5   r6   r   r7   rY   r?   r   rò   r¸   r   rñ   rÏ   rÐ   rÌ   )r;   rY   r£   rß   rÑ   s   &    r)   Ú0test_failedPrivateKeyAuthenticationWithSignatureÚGSSHUserAuthServerTests.test_failedPrivateKeyAuthenticationWithSignatureš  sà   € ô
 �x‰x×"Ñ"¤7×#<Ñ#<Ó=×BÑBÓDˆÜ�h‰h×!Ñ!¤'×"<Ñ"<Ó=ˆäˆv‹JÜ�‹kõä�Óõð õô �‹nõ	ô
 �‹hõô �—‘˜$“Ó õ!ð 	ð /6ˆ�‰×!Ñ!Ô+Ø�O‰O×0Ñ0°Ó8ˆØ�}‰}˜T×.Ñ.Ó/Ð/r(   c                óº  € \         P                  P                  \        P                  4      P                  4       p\        R4      VR,          ,           p\        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           \        V4      ,           pV P                  P                  V4      pVP                  V P                  4      # )zh
Private key authentication fails when the public key type is
unsupported or the public key is corrupt.
s   ssh-bad-type:é   NNrC   rn   rë   rÆ   r  r  r  s   &   r)   Útest_unsupported_publickeyÚ1SSHUserAuthServerTests.test_unsupported_publickey®  s´   € ô
 �x‰x×"Ñ"¤7×#<Ñ#<Ó=×BÑBÓDˆô �/Ó" T¨#¥YÕ.ˆô ˆv‹JÜ�‹kõä�Óõð õô �‹nõ	ô
 �‹hõð 	ð �O‰O×0Ñ0°Ó8ˆà�}‰}˜T×.Ñ.Ó/Ð/r(   c                óZ  € \         P                  ! 4       p\        V P                  4      Vn        V P                  P                  \        4       4       VP                  4        VP                  4        VP                  P                  4        V P                  VP                  RR.4       R# )a0  
L{SSHUserAuthServer} sets up
C{SSHUserAuthServer.supportedAuthentications} by checking the portal's
credentials interfaces and mapping them to SSH authentication method
strings.  If the Portal advertises an interface that
L{SSHUserAuthServer} can't map, it should be ignored.  This is a white
box test.
rÕ   rë   N)r   r·   rc   ru   r   r¶   r¦   rh   r¾   r¹   rº   rÉ   )r;   Úservers   & r)   Ú test_ignoreUnknownCredInterfacesÚ7SSHUserAuthServerTests.test_ignoreUnknownCredInterfacesÄ  s~   € ô ×+Ò+Ó-ˆÜ(¨¯©Ó5ˆÔØ�‰×#Ñ#Ô$4Ó$6Ô7Ø×ÑÔØ×ÑÔØ×'Ñ'×,Ñ,Ô.Ø×Ñ˜×8Ñ8¸;ÈÐ:UÖVr(   c                óF  € V P                  RV P                  P                  4       \        P                  ! 4       p\        V P                  4      Vn        R VP                  n        VP                  4        VP                  4        V P                  RVP                  4       \        P                  ! 4       p\        V P                  4      Vn        R VP                  n        VP                  4        VP                  4        V P                  RVP                  4       R# )zw
Test that the userauth service does not advertise password
authentication if the password would be send in cleartext.
rÕ   c                 ó   € R # ©Fr    ©Úxs   &r)   rŒ   ÚISSHUserAuthServerTests.test_removePasswordIfUnencrypted.<locals>.<lambda>Þ  ó   € ¹%r(   c                 ó   € V R 8H  # ©Úinr    r*  s   &r)   rŒ   r,  å  ó   € ¸¸dºr(   N)ÚassertInr¸   r¹   r   r·   rc   ru   r   r‚   rh   r¾   ÚassertNotIn)r;   ÚclearAuthServerÚhalfAuthServers   &  r)   Ú test_removePasswordIfUnencryptedÚ7SSHUserAuthServerTests.test_removePasswordIfUnencryptedÕ  sÐ   € ð
 	�‰�k 4§?¡?×#KÑ#KÔLä"×4Ò4Ó6ˆÜ$1°$·+±+Ó$>ˆÔ!Ù0?ˆ×!Ñ!Ô-Ø×&Ñ&Ô(Ø×&Ñ&Ô(Ø×Ñ˜ o×&NÑ&NÔOä!×3Ò3Ó5ˆÜ#0°·±Ó#=ˆÔ Ù/Bˆ× Ñ Ô,Ø×%Ñ%Ô'Ø×%Ñ%Ô'Ø�‰�k >×#JÑ#JÖKr(   c                ó2  € \        V P                  4      pVP                  \        4       4       \        P
                  ! 4       p\        V4      Vn        R VP                  n        VP                  4        VP                  4        V P                  VP                  R.4       \        P
                  ! 4       p\        V4      Vn        R VP                  n        VP                  4        VP                  4        V P                  VP                  R.4       R# )z¡
If the L{SSHUserAuthServer} is not advertising passwords, then an
unencrypted connection should not cause any warnings or exceptions.
This is a white box test.
c                 ó   € R # r)  r    r*  s   &r)   rŒ   ÚSSSHUserAuthServerTests.test_unencryptedConnectionWithoutPasswords.<locals>.<lambda>÷  r-  r(   rë   c                 ó   € V R 8H  # r/  r    r*  s   &r)   rŒ   r:  ÿ  r1  r(   N)r   rµ   r¶   rž   r   r·   rc   r   r‚   rh   r¾   rÉ   r¹   )r;   ru   r4  r5  s   &   r)   Ú*test_unencryptedConnectionWithoutPasswordsÚASSHUserAuthServerTests.test_unencryptedConnectionWithoutPasswordsê  sÚ   € ô ˜Ÿ
™
Ó#ˆØ×ÑÔ0Ó2Ô3ô #×4Ò4Ó6ˆÜ$1°&Ó$9ˆÔ!Ù0?ˆ×!Ñ!Ô-Ø×&Ñ&Ô(Ø×&Ñ&Ô(Ø×Ñ˜×AÑAÀLÀ>ÔRô "×3Ò3Ó5ˆÜ#0°Ó#8ˆÔ Ù/Bˆ× Ñ Ô,Ø×%Ñ%Ô'Ø×%Ñ%Ô'Ø×Ñ˜×AÑAÀLÀ>ÖRr(   c                óD  € \         P                  ! 4       p\        P                  ! 4       Vn        \        V P                  4      Vn        VP                  4        VP                  P                  R4       VP                  4        V P                  VP                  P                  \        P                  R\        \        P                  34      ,           \!        R4      ,           \!        R4      ,           3.4       V P#                  VP                  P$                  4       R# )z 
Test that the login times out.
s   you took too longr(   Né°š  ó      )r   r·   r   rä   rå   rc   ru   r   rh   ræ   r¾   rÉ   rw   ÚMSG_DISCONNECTró   Ú)DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLEr   Ú
assertTruerv   ©r;   ÚtimeoutAuthServers   & r)   Útest_loginTimeoutÚ(SSHUserAuthServerTests.test_loginTimeout  sã   € ô %×6Ò6Ó8ÐÜ"&§*¢*£,ÐÔÜ&3°D·K±KÓ&@ÐÔ#Ø×(Ñ(Ô*Ø×Ñ×'Ñ'¨Ô5Ø×(Ñ(Ô*Ø×ÑØ×'Ñ'×/Ñ/ô ×,Ñ,ØÜœY×PÑPÐRÓSõTäÐ-Ó.õ/ô ˜“gõððô	
ð 	�‰Ð)×3Ñ3×BÑBÖCr(   c                ó¤  € \         P                  ! 4       p\        P                  ! 4       Vn        \        V P                  4      Vn        VP                  4        VP                  4        VP                  P                  R4       V P                  VP                  P                  . 4       V P                  VP                  P                  4       R# )z>
Test that stopping the service also stops the login timeout.
Nr?  )r   r·   r   rä   rå   rc   ru   r   rh   r¾   ræ   rÉ   rw   ÚassertFalserv   rD  s   & r)   Útest_cancelLoginTimeoutÚ.SSHUserAuthServerTests.test_cancelLoginTimeout  s˜   € ô %×6Ò6Ó8ÐÜ"&§*¢*£,ÐÔÜ&3°D·K±KÓ&@ÐÔ#Ø×(Ñ(Ô*Ø×(Ñ(Ô*Ø×Ñ×'Ñ'¨Ô5Ø×ÑÐ*×4Ñ4×<Ñ<¸bÔAØ×ÑÐ*×4Ñ4×CÑCÖDr(   c           	     ó’  a € RP                  \        R4      \        R4      \        R4      R\        R4      .4      p\        P                  ! 4       S P                  n        \        ^4       FC  pS P                  P                  V4      pS P                  P
                  P                  ^4       KE  	  V 3R lpXP                  V4      # )zU
Test that the server disconnects if the client fails authentication
too many times.
r(   rC   rn   rÕ   rÆ   rã   c                 ó  <€ SP                  SP                  P                  P                  R,          \        P                  R\        \        P                  34      ,           \        R4      ,           \        R4      ,           34       R# )é   s   too many bad authsr(   NrÇ   r@  )rÉ   r¸   r   rw   rA  ró   rB  r   rÚ   s   &€r)   rÛ   Ú:SSHUserAuthServerTests.test_tooManyAttempts.<locals>.check4  sm   ø€ Ø×ÑØ—‘×)Ñ)×1Ñ1°"Õ5ä×,Ñ,ØÜœY×PÑPÐRÓSõTäÐ.Ó/õ0ô ˜“gõðö	r(   )
rÞ   r   r   rä   r¸   rå   ÚrangerÏ   ræ   rÐ   )r;   rß   ÚirÑ   rÛ   s   f    r)   Útest_tooManyAttemptsÚ+SSHUserAuthServerTests.test_tooManyAttempts)  s�   ø€ ð
 —‘œ2˜f›:¤r¨'£{´B°{³OÀUÌBÈvËJÐWÓXˆÜ $§
¢
£ˆ�‰ÔÜ�r–ˆAØ—‘×4Ñ4°VÓ<ˆAØ�O‰O×!Ñ!×)Ñ)¨!Ö,ñ õ
	ð �}‰}˜UÓ#Ð#r(   c                ó.   <€ V ^8„  d   QhRS[ R,          /# r®   r   )r±   rR   s   "€r)   r²   r³   B  s   ø€ ÷ 	0ñ 	0©8°D­>ñ 	0r(   c                óF  € \        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           p\        P                  ! 4       V P                  n        V P                  P                  V4      pVf   Q hVP                  V P                  4      # )zW
If the user requests a service that we don't support, the
authentication should fail.
rC   r(   rÕ   rÆ   )r   r   rä   r¸   rå   rÏ   rÐ   rÌ   rç   s   &  r)   Útest_failIfUnknownServiceÚ0SSHUserAuthServerTests.test_failIfUnknownServiceB  sr   € ô
 �F“œb ›gÕ%¬¨;«Õ7¸%Õ?Ä"ÀVÃ*ÕLˆÜ $§
¢
£ˆ�‰ÔØ�O‰O×0Ñ0°Ó8ˆØŠ}Ðˆ}Ø�}‰}˜T×.Ñ.Ó/Ð/r(   c                ó  a € R pS P                  S P                  RV4       S P                  S P                  RR4       V 3R lpS P                  P                  RRR4      pS P                  V\        4      P                  V4      # )a"  
tryAuth() has two edge cases that are difficult to reach.

1) an authentication method auth_* returns None instead of a Deferred.
2) an authentication type that is defined does not have a matching
   auth_* method.

Both these cases should return a Deferred which fails with a
ConchError.
c                 ó   € R # rO   r    )rß   s   &r)   ÚmockAuthÚ>SSHUserAuthServerTests.test_tryAuthEdgeCases.<locals>.mockAuthY  r  r(   Úauth_publickeyÚauth_passwordNc                 ój   <€ SP                   P                  R RR4      pSP                  V\        4      # )rÕ   N)r¸   r  r  r   )rÃ   Úd2r;   s   & €r)   Ú
secondTestÚ@SSHUserAuthServerTests.test_tryAuthEdgeCases.<locals>.secondTest_  s.   ø€ Ø—‘×(Ñ(¨°d¸DÓAˆBØ×%Ñ% b¬*Ó5Ð5r(   rë   )r  r¸   r  r  r   rÐ   )r;   rZ  r`  Úd1s   f   r)   Útest_tryAuthEdgeCasesÚ,SSHUserAuthServerTests.test_tryAuthEdgeCasesM  sp   ø€ ò	ð 	�
‰
�4—?‘?Ð$4°hÔ?Ø�
‰
�4—?‘? O°TÔ:õ	6ð �_‰_×$Ñ$ \°4¸Ó>ˆØ×!Ñ! "¤jÓ1×=Ñ=¸jÓIÐIr(   )r¸   ru   rµ   )r"   r#   r$   r%   r&   r   Úskipr»   r¿   rÌ   rÒ   rà   rè   rõ   r  r  r  r  r!  r%  r6  r<  rF  rJ  rR  rV  rc  r'   rP   rQ   s   @r)   r«   r«   é   s•   ø‡ € ñð ‚|Ø0ˆ÷8ð 8ò÷	
ð 	
ò
0ò$ò&0ò"$ò:1ò4$ò.0ò"0ò(0ò,Wò"Lò*Sò4Dò0Eò$÷2	0ð 	0÷Jð Jr(   r«   c                   óŠ   a € ] tR tRt o Rt]f   RtR tR tR t	R t
R	 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# )ÚSSHUserAuthClientTestsig  z
Tests for SSHUserAuthClient.
Nr¬   c                óê   € \        R \        P                  4       4      V n        \        R4      V P                  n        RV P                  P                  n        V P                  P                  4        R# )rC   Nrí   )r2   rc   rj   Ú
authClientr   rñ   rh   r:   s   &r)   r»   ÚSSHUserAuthClientTests.setUpo  sL   € Ü(¨´×1FÑ1FÓ1HÓIˆŒÜ$1°$Ó$7ˆ�‰Ô!Ø.5ˆ�‰×!Ñ!Ô+Ø�‰×&Ñ&Ö(r(   c                óH   € V P                   P                  4        R V n         R # rO   )ri  r¾   r:   s   &r)   r¿   ÚSSHUserAuthClientTests.tearDownu  rÁ   r(   c                ó†  € V P                  V P                  P                  R4       V P                  V P                  P                  P                  R4       V P                  V P                  P
                  P                  \        P                  \        R4      \        R4      ,           \        R4      ,           3.4       R# )z+
Test that client is initialized properly.
rC   rf   rn   N)
rÉ   ri  rý   ÚinstancerJ   r   rw   r   rô   r   r:   s   &r)   Ú	test_initÚ SSHUserAuthClientTests.test_inity  s†   € ð 	×Ñ˜Ÿ™×-Ñ-¨vÔ6Ø×Ñ˜Ÿ™×1Ñ1×6Ñ6¸ÔAØ×ÑØ�O‰O×%Ñ%×-Ñ-Ü×+Ñ+¬R°«Z¼"¸X»,Õ-FÌÈGËÕ-TÐUÐVö	
r(   c                óÞ   a€ R.oV3R lpWP                   P                  n        V P                   P                  R4       V P	                  S^ ,          V P                   P
                  4       R# )z)
Test that the client succeeds properly.
Nc                 ó   <€ V S^ &   R# )rŠ   Nr    )ro   rn  s   &€r)   ÚstubSetServiceÚDSSHUserAuthClientTests.test_USERAUTH_SUCCESS.<locals>.stubSetServiceŠ  s   ø€ Ø!ˆH�Q‹Kr(   r(   )ri  r   Ú
setServiceÚssh_USERAUTH_SUCCESSrÉ   rn  )r;   rs  rn  s   & @r)   Útest_USERAUTH_SUCCESSÚ,SSHUserAuthClientTests.test_USERAUTH_SUCCESS„  sS   ø€ ð �6ˆõ	"ð 0>�‰×!Ñ!Ô,Ø�‰×,Ñ,¨SÔ1Ø×Ñ˜ !� d§o¡o×&>Ñ&>Ö?r(   c           
     ó°  € V P                   P                  \        R4      R,           4       V P                  V P                   P                  P
                  R	,          \        P                  \        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           \        \        P                  P                  \        P                  4      P                  4       4      ,           34       V P                   P                  \        R4      R,           4       \        \        P                  P                  \        P                  4      P                  4       4      pV P                  V P                   P                  P
                  R	,          \        P                  \        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           V,           34       V P                   P                  \        R4      \        \        P                  P                  \        P                  4      P                  4       4      ,           4       \        V P                   P                  P                   4      \#        \        P                  34      ,           \        R4      ,           \        R4      ,           \        R4      ,           R,           \        R4      ,           V,           p\        P                  P                  \        P$                  4      pV P                  V P                   P                  P
                  R	,          \        P                  \        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           V,           \        VP'                  V4      4      ,           34       R# )
z:
Test that the client can authenticate with a public key.
rë   rÆ   rC   rf   s   ssh-dssr  ó   NrÇ   )ri  Ússh_USERAUTH_FAILUREr   rÉ   r   rw   r   rô   r   r5   r6   r   r9   rY   r7   Ússh_USERAUTH_PK_OKrñ   ró   r?   rò   )r;   rY   r¢   r£   s   &   r)   Útest_publickeyÚ%SSHUserAuthClientTests.test_publickey‘  sã  € ð 	�‰×,Ñ,¬R°Ó-=ÀÕ-GÔHØ×ÑØ�O‰O×%Ñ%×-Ñ-¨bÕ1ä×-Ñ-Ü�6“
Ü�X“,õä�\Ó"õ#ð õô �Z“.õ	!ô
 ”T—X‘X×(Ñ(¬×)BÑ)BÓC×HÑHÓJÓKõLðô	
ð 	�‰×,Ñ,¬R°Ó-=ÀÕ-GÔHÜ”$—(‘(×%Ñ%¤g×&?Ñ&?Ó@×EÑEÓGÓHˆØ×ÑØ�O‰O×%Ñ%×-Ñ-¨bÕ1ä×-Ñ-ä�v“JÜ˜“lõ#ä˜Ó&õ'ð õô ˜“nõ	%ð
 õð
ô	
ð 	�‰×*Ñ*Üˆz‹NœR¤§¡× 3Ñ 3´G×4MÑ4MÓ N× SÑ SÓ UÓVÕVô	
ô ˆt�‰×(Ñ(×2Ñ2Ó3Ü”X×2Ñ2Ð4Ó5õ6ä�‹jõô �‹lõô �Óõ	ð
 õô �‹nõð õð 	ô �h‰h×!Ñ!¤'×"<Ñ"<Ó=ˆØ×ÑØ�O‰O×%Ñ%×-Ñ-¨bÕ1ä×-Ñ-Ü�6“
Ü�X“,õä�\Ó"õ#ð õô �Z“.õ	!ð
 õô �S—X‘X˜gÓ&Ó'õ(ð	ö	
r(   c                óè  € \        R\        P                  4       4      p\        R4      Vn        RVP                  n        VP                  4        VP                  R4       . VP                  n        V P                  VP                  R4      4       V P                  VP                  P                  \        P                  \        R4      \        R4      ,           \        R4      ,           3.4       R# )zœ
If the SSHUserAuthClient doesn't return anything from signData,
the client should start the authentication over again by requesting
'none' authentication.
rC   Nrí   rë   r(   rf   rn   )r]   rc   rj   r   rñ   rh   r  rw   ÚassertIsNoner|  rÉ   r   rô   r   )r;   ri  s   & r)   Ú!test_publickey_without_privatekeyÚ8SSHUserAuthClientTests.test_publickey_without_privatekeyÏ  s¹   € ô 1°¼×9NÑ9NÓ9PÓQˆ
ä,¨TÓ2ˆ
ÔØ)0ˆ
×ÑÔ&Ø×!Ñ!Ô#Ø×Ñ˜<Ô(Ø')ˆ
×ÑÔ$Ø×Ñ˜*×7Ñ7¸Ó<Ô=Ø×ÑØ× Ñ ×(Ñ(Ü×+Ñ+¬R°«Z¼"¸X»,Õ-FÌÈGËÕ-TÐUÐVö	
r(   c                óŒ   a € R S P                   n        S P                   P                  R4      pV 3R lpVP                  V4      # )zc
If there's no public key, auth_publickey should return a Deferred
called back with a False value.
c                 ó   € R # rO   r    r*  s   &r)   rŒ   Ú:SSHUserAuthClientTests.test_no_publickey.<locals>.<lambda>ç  ó   € ±r(   rë   c                 ó*   <€ SP                  V 4       R # rO   )rI  )Úresultr;   s   &€r)   rÛ   Ú7SSHUserAuthClientTests.test_no_publickey.<locals>.checkê  s   ø€ Ø×Ñ˜VÖ$r(   )ri  r<   r  rÐ   )r;   rÑ   rÛ   s   f  r)   Útest_no_publickeyÚ(SSHUserAuthClientTests.test_no_publickeyâ  s;   ø€ ñ
 (6ˆ�‰Ô$Ø�O‰O×#Ñ# LÓ1ˆõ	%ð �}‰}˜UÓ#Ð#r(   c                óî  € V P                   P                  \        R4      R,           4       V P                  V P                   P                  P
                  R,          \        P                  \        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           34       V P                   P                  \        R4      \        R4      ,           4       V P                  V P                   P                  P
                  R,          \        P                  \        R4      \        R4      ,           \        R4      ,           R,           \        R4      ^,          ,           34       R# )	z`
Test that the client can authentication with a password.  This
includes changing the password.
rÕ   rÆ   rC   rf   r(   rì   NrÇ   )	ri  r{  r   rÉ   r   rw   r   rô   r|  r:   s   &r)   Útest_passwordÚ$SSHUserAuthClientTests.test_passwordï  sû   € ð
 	�‰×,Ñ,¬R°«_¸wÕ-FÔGØ×ÑØ�O‰O×%Ñ%×-Ñ-¨bÕ1ä×-Ñ-Ü�6“
œR ›\Õ)¬B¨{«OÕ;¸gÕEÌÈ6Ë
ÕRðô	
ð 	�‰×*Ñ*¬2¨c«7´R¸³WÕ+<Ô=Ø×ÑØ�O‰O×%Ñ%×-Ñ-¨bÕ1ä×-Ñ-Ü�6“
œR ›\Õ)¬B¨{«OÕ;¸gÕEÌÈ6Ë
ÐUVÍÕVðö	
r(   c                ó~   € R V P                   n        V P                  V P                   P                  R4      4       R# )z;
If getPassword returns None, tryAuth should return False.
c                  ó   € R # rO   r    r    r(   r)   rŒ   Ú9SSHUserAuthClientTests.test_no_password.<locals>.<lambda>	  s   € ©dr(   rÕ   N)ri  rF   rI  r  r:   s   &r)   Útest_no_passwordÚ'SSHUserAuthClientTests.test_no_password  s-   € ñ '3ˆ�‰Ô#Ø×Ñ˜Ÿ™×0Ñ0°Ó=Ö>r(   c                ó˜  € V P                   P                  \        R4      \        R4      ,           \        R4      ,           R,           \        R4      ,           R,           4       V P                  V P                   P                  P
                  R,          \        P                  R\        R4      ,           \        R4      ,           34       R# )	zR
Make sure that the client can authenticate with the keyboard
interactive method.
r(   s      s
   Password: rÆ   s      rC   NrÇ   )ri  Ú'ssh_USERAUTH_PK_OK_keyboard_interactiver   rÉ   r   rw   r   ÚMSG_USERAUTH_INFO_RESPONSEr:   s   &r)   Útest_keyboardInteractiveÚ/SSHUserAuthClientTests.test_keyboardInteractive  s£   € ð
 	�‰×?Ñ?Üˆs‹GÜ�‹gõä�‹gõð "õ"ô �Óõ	 ð
 õô	
ð 	×ÑØ�O‰O×%Ñ%×-Ñ-¨bÕ1ä×3Ñ3Ø#¤b¨£jÕ0´2°f³:Õ=ðö	
r(   c                óh  € RV P                   n        . V P                   P                  n        V P                   P	                  R4       V P                  V P                   P                  P                  \        P                  \        R4      \        R4      ,           \        R4      ,           3.4       R# )zž
If C{SSHUserAuthClient} gets a MSG_USERAUTH_PK_OK packet when it's not
expecting it, it should fail the current authentication and move on to
the next type.
s   unknownr(   rC   rf   rn   N)	ri  ÚlastAuthr   rw   r|  rÉ   r   rô   r   r:   s   &r)   Ú"test_USERAUTH_PK_OK_unknown_methodÚ9SSHUserAuthClientTests.test_USERAUTH_PK_OK_unknown_method!  s|   € ð $.ˆ�‰Ô Ø,.ˆ�‰×!Ñ!Ô)Ø�‰×*Ñ*¨3Ô/Ø×ÑØ�O‰O×%Ñ%×-Ñ-Ü×+Ñ+¬R°«Z¼"¸X»,Õ-FÌÈGËÕ-TÐUÐVö	
r(   c                óˆ  a € V 3R lpV 3R lpVS P                   n        VS P                   n        S P                   P                  \	        R4      R,           4       S P                  S P                   P                  P                  R,          \        P                  \	        R4      \	        R4      ,           \	        R4      ,           R,           \	        R4      ,           34       S P                   P                  \	        R4      R	,           4       S P                  S P                   P                  P                  RR
 RR.4       R
# )z·
ssh_USERAUTH_FAILURE should sort the methods by their position
in SSHUserAuthClient.preferredOrder.  Methods that are not in
preferredOrder should be sorted at the end of that list.
c                  óT   <€ S P                   P                  P                  ^ÿR4       R# )éÿ   ó   here is dataN©ri  r   r~   r:   s   €r)   Úauth_firstmethodÚNSSHUserAuthClientTests.test_USERAUTH_FAILURE_sorting.<locals>.auth_firstmethod6  s   ø€ Ø�O‰O×%Ñ%×0Ñ0°°oÖFr(   c                  óT   <€ S P                   P                  P                  ^þR4       R# )éþ   ó
   other dataTr¡  r:   s   €r)   Úauth_anothermethodÚPSSHUserAuthClientTests.test_USERAUTH_FAILURE_sorting.<locals>.auth_anothermethod9  s    ø€ Ø�O‰O×%Ñ%×0Ñ0°°mÔDÙr(   s   anothermethod,passwordrÆ   rC   rf   rÕ   s"   firstmethod,anothermethod,passwordrì   NrÇ   éþÿÿÿ)rŸ  r   )r¥  r¦  )
ri  r¢  r§  r{  r   rÉ   r   rw   r   rô   )r;   r¢  r§  s   f  r)   Útest_USERAUTH_FAILURE_sortingÚ4SSHUserAuthClientTests.test_USERAUTH_FAILURE_sorting/  s÷   ø€ õ	Gõ	ð ,<ˆ�‰Ô(Ø-?ˆ�‰Ô*ð 	�‰×,Ñ,¬RÐ0IÓ-JÈWÕ-TÔUà×ÑØ�O‰O×%Ñ%×-Ñ-¨bÕ1ä×-Ñ-Ü�6“
œR ›\Õ)¬B¨{«OÕ;¸gÕEÌÈ6Ë
ÕRðô	
ð 	�‰×,Ñ,ÜÐ4Ó5¸Õ?ô	
ð 	×ÑØ�O‰O×%Ñ%×-Ñ-¨b¨cÐ2Ø#Ð%9Ð:ö	
r(   c                ón  € V P                   P                  \        R4      R,           4       V P                   P                  \        R4      R,           4       V P                  V P                   P                  P
                  R,          \        P                  R\        R4      ,           R,           34       R# )	z›
If there are no more available user authentication messages,
the SSHUserAuthClient should disconnect with code
DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE.
rÕ   rÆ   rì   s      s(   no more authentication methods availables       NrÇ   )ri  r{  r   rÉ   r   rw   rA  r:   s   &r)   Ú%test_disconnectIfNoMoreAuthenticationÚ<SSHUserAuthClientTests.test_disconnectIfNoMoreAuthenticationS  sˆ   € ð 	�‰×,Ñ,¬R°«_¸wÕ-FÔGØ�‰×,Ñ,¬R°«_¸wÕ-FÔGØ×ÑØ�O‰O×%Ñ%×-Ñ-¨bÕ1ä×(Ñ(Ø#ÜÐ@ÓAõBà%õ&ðö	
r(   c                óF  € . V P                   P                  n        V P                   P                  R4       V P	                  V P                   P                  P                  \
        P                  \        R4      \        R4      ,           \        R4      ,           3.4       R# )zp
_ebAuth (the generic authentication error handler) should send
a request for the 'none' authentication method.
NrC   rf   rn   )ri  r   rw   Ú_ebAuthrÉ   r   rô   r   r:   s   &r)   Útest_ebAuthÚ"SSHUserAuthClientTests.test_ebAuthe  sp   € ð
 -/ˆ�‰×!Ñ!Ô)Ø�‰×Ñ Ô%Ø×ÑØ�O‰O×%Ñ%×-Ñ-Ü×+Ñ+¬R°«Z¼"¸X»,Õ-FÌÈGËÕ-TÐUÐVö	
r(   c                ó4  a aaa€ \         P                  ! R\        P                  4       4      oS P	                  SP                  4       4       VVV 3R lpVVV 3R loR oSP                  4       pVP                  S P                  4      P                  V4      # )z»
getPublicKey() should return None.  getPrivateKey() should return a
failed Deferred.  getPassword() should return a failed Deferred.
getGenericAnswers() should return a failed Deferred.
rC   c                 ó¢   <€ V P                  \        4       SP                  4       pVP                  SP                  4      P                  S4      # rO   )ÚtrapÚNotImplementedErrorrF   rÐ   r˜   Ú
addErrback)rˆ  rÑ   ri  Úcheck2r;   s   & €€€r)   rÛ   Ú3SSHUserAuthClientTests.test_defaults.<locals>.checkz  s<   ø€ Ø�K‰KÔ+Ô,Ø×&Ñ&Ó(ˆAØ—=‘= §¡Ó+×6Ñ6°vÓ>Ð>r(   c                 ó¨   <€ V P                  \        4       SP                  R R R 4      pVP                  SP                  4      P                  S4      # rO   )rµ  r¶  rM   rÐ   r˜   r·  )rˆ  rÑ   ri  Úcheck3r;   s   & €€€r)   r¸  Ú4SSHUserAuthClientTests.test_defaults.<locals>.check2  sB   ø€ Ø�K‰KÔ+Ô,Ø×,Ñ,¨T°4¸Ó>ˆAØ—=‘= §¡Ó+×6Ñ6°vÓ>Ð>r(   c                 ó0   € V P                  \        4       R # rO   )rµ  r¶  )rˆ  s   &r)   r»  Ú4SSHUserAuthClientTests.test_defaults.<locals>.check3„  s   € Ø�K‰KÔ+Ö,r(   )
r   r0   rc   rj   r€  r<   r@   rÐ   r˜   r·  )r;   rÛ   rÑ   ri  r¸  r»  s   f  @@@r)   Útest_defaultsÚ$SSHUserAuthClientTests.test_defaultsq  st   û€ ô ×/Ò/°¼×8MÑ8MÓ8OÓPˆ
Ø×Ñ˜*×1Ñ1Ó3Ô4÷	?÷
	?ò
	-ð ×$Ñ$Ó&ˆØ�}‰}˜TŸY™YÓ'×2Ñ2°5Ó9Ð9r(   )ri  )r"   r#   r$   r%   r&   r   re  r»   r¿   ro  rw  r}  r�  rŠ  r�  r’  r—  r›  rª  r­  r±  r¿  r'   rP   rQ   s   @r)   rg  rg  g  si   ø‡ € ñð ‚|Ø0ˆò)òò	
ò@ò<
ò|
ò&$ò
ò,?ò
ò*
ò"
òH
ò$

÷:ð :r(   rg  c                   óF   a € ] tR tRt o ]f   Rt ! R R4      tR tRtV t	R# )ÚLoopbackTestsi‹  Nr¬   c                   ó:   a € ] tR tRt o  ! R R4      tR tRtV tR# )ÚLoopbackTests.Factoryi�  c                   ó0   a € ] tR tRt o RtR tR tRtV tR# )ÚLoopbackTests.Factory.Servicei�  ó   TestServicec                ó:   € V P                   P                  4        R # rO   )r   r…   r:   s   &r)   rh   Ú,LoopbackTests.Factory.Service.serviceStarted“  s   € Ø—‘×-Ñ-Ö/r(   c                ó   € R # rO   r    r:   s   &r)   r¾   Ú,LoopbackTests.Factory.Service.serviceStopped–  s   € Ùr(   r    N)	r"   r#   r$   r%   rJ   rh   r¾   r'   rP   rQ   s   @r)   rj   rÆ  �  s   ø‡ € Ø!ˆDò0÷ð r(   rj   c                ó   € V P                   # rO   )rj   )r;   ÚavatarrJ   s   &&&r)   rp   Ú LoopbackTests.Factory.getService™  s   € Ø—<‘<Ðr(   r    N)r"   r#   r$   r%   rj   rp   r'   rP   rQ   s   @r)   rr   rÄ  �  s   ø‡ € ÷	ñ 	÷	 ð 	 r(   rr   c                ód  a aa€ \         P                  ! 4       o\        RS P                  P	                  4       4      p\
        P                  ! 4       Sn        SSP
                  n        R SP
                  n        \
        P                  ! 4       Vn        WP
                  n        R;SP
                  n	        VP
                  n	        R ;SP
                  n
        VP
                  n
        S P                  4       SP
                  n        ^ Sn        \        4       p\        V4      p\        4       oSP!                  \#        4       4       SP!                  \%        4       4       V3R lSn        VP!                  S4       VSP
                  P                  n        \*        P,                  ! SP
                  VP
                  4      pR SP
                  P
                  n        R VP
                  P
                  n        SP1                  4        VP1                  4        V V3R lpVP3                  V4      # )	zG
Test that the userauth server and client play nicely with each other.
rC   c                 ó   € R # )Tr    r*  s   &r)   rŒ   Ú-LoopbackTests.test_loopback.<locals>.<lambda>¦  r†  r(   r(   c                  ó   € R # rO   r    r    r(   r)   rŒ   rÑ  «  s   € Édr(   c                 óB   <€ \        SP                  V ,          4      ^8H  # )r¯   )ÚlenÚsuccessfulCredentials)ÚaIdÚcheckers   &€r)   rŒ   rÑ  µ  s   ø€ ¤s¨7×+HÑ+HÈÕ+MÓ'NÐRSÒ'Sr(   c                  ó   € R # )Ú_ServerLoopbackr    r    r(   r)   rŒ   rÑ  º  ó   € Ñ7Hr(   c                  ó   € R # )Ú_ClientLoopbackr    r    r(   r)   rŒ   rÑ  »  rÚ  r(   c                 óh   <€ SP                  SP                  P                  P                  R 4       R# )rÇ  N)rÉ   r   ro   rJ   )rÃ   r;   r$  s   &€€r)   rÛ   Ú*LoopbackTests.test_loopback.<locals>.checkÀ  s%   ø€ Ø×Ñ˜V×-Ñ-×5Ñ5×:Ñ:¸NÖKr(   )r   r·   r2   rr   rj   r   r*   ro   r‚   rñ   ÚsendKexInitrt   ÚpasswordDelayrˆ   r   r   r¶   r”   rž   ÚareDoneru   r   ÚloopbackAsyncÚ	logPrefixrh   rÐ   )r;   Úclientrµ   ru   rÑ   rÛ   r×  r$  s   f     @@r)   Útest_loopbackÚLoopbackTests.test_loopbackœ  s§  ú€ ô ×+Ò+Ó-ˆÜ ¨¯©×(<Ñ(<Ó(>Ó?ˆô %×5Ò5Ó7ˆÔØ#)ˆ×ÑÔ Ù'5ˆ×ÑÔ$Ü$×5Ò5Ó7ˆÔØ#)×ÑÔ ØBEÐEˆ×ÑÔ" V×%5Ñ%5Ô%?áFRÐRˆ×ÑÔ$ v×'7Ñ'7Ô'Cð $(§<¡<£>ˆ×ÑÔ Ø ˆÔÜ“ˆÜ˜“ˆÜ$Ó&ˆØ×Ñ¤Ó 1Ô2Ø×ÑÔ 1Ó 3Ô4ÜTˆŒØ×Ñ˜wÔ'Ø*0ˆ×Ñ× Ñ Ô'ä×"Ò" 6×#3Ñ#3°V×5EÑ5EÓFˆÙ/Hˆ×Ñ×"Ñ"Ô,Ù/Hˆ×Ñ×"Ñ"Ô,à×ÑÔØ×ÑÔö	Lð �}‰}˜UÓ#Ð#r(   r    )
r"   r#   r$   r%   r   re  rr   rå  r'   rP   rQ   s   @r)   rÂ  rÂ  ‹  s#   ø‡ € Ø‚|Ø0ˆ÷ ñ  ÷'$ð '$r(   rÂ  c                   ó2   a € ] tR tRt o ]f   RtR tRtV tR# )ÚModuleInitializationTestsiÆ  Nr¬   c                óÊ   € V P                  \        P                  P                  ^<,          R4       V P                  \        P                  P                  ^<,          R4       R# )é<   r  N)rÉ   r   r·   ÚprotocolMessagesr0   r:   s   &r)   Útest_messagesÚ'ModuleInitializationTests.test_messagesÊ  sP   € ð 	×ÑÜ×&Ñ&×7Ñ7¸Õ;Ð=Qô	
ð 	×ÑÜ×&Ñ&×7Ñ7¸Õ;Ð=Qö	
r(   r    )	r"   r#   r$   r%   r   re  rì  r'   rP   rQ   s   @r)   rè  rè  Æ  s   ø‡ € Ø‚|Ø0ˆ÷
ð 
r(   rè  c                óV   € V ^8„  d   Qh/ ^ \         9   d   \        \        ,          ;R&   # )r¯   r   )Ú__conditional_annotations__r   r   )r±   s   "r)   r²   r²      s#   € ÷ ñ ÷, "Ò !„hŒzÕÑ !ò-r(   );rï  r&   Útypesr   Útypingr   Úzope.interfacer   Útwisted.conch.errorr   r   Útwisted.cred.checkersr   Útwisted.cred.credentialsr   r	   r
   Útwisted.cred.errorr   Útwisted.cred.portalr   r   Útwisted.internetr   r   Útwisted.internet.deferr   Útwisted.protocolsr   Útwisted.python.reflectr   Útwisted.trialr   r   Útwisted.conch.checkersr   Útwisted.conch.sshr   r   Útwisted.conch.ssh.commonr   Útwisted.conch.testr   r0   r2   rT   r]   r*   rc   rˆ   r”   rž   r¦   ÚTestCaser«   rg  rÂ  rè  r²   )rï  s   @r)   Ú<module>r     s‹  øðöõ Ý å &ç :Ý 5ß RÑ RÝ 0ß .ß (Ý +Ý &Ý 0Ý "à!€Ó !Ù�× Ò Ý9ß;Ñ;Ý+Þ*÷ñ ÷ñ ô -�X×/Ñ/ô  -ôF
E�H×.Ñ.ô 
Eô	> (×"<Ñ"<ô 	>ô>#�I×.Ñ.ô >#ñB ˆVÓ÷	Bð 	Bó ð	Bñ Ð Ó!÷Oð Oó "ðOñ Ð Ó!÷"ð "ó "ð"ñ& Ð Ó!÷	ð 	ó "ð	ô{J˜X×.Ñ.ô {Jô|a:˜X×.Ñ.ô a:ôH	8$�H×%Ñ%ô 8$ôv
 × 1Ñ 1ö 
r(   