+
    üÐj¡  ã                   óì   € R t ^ RIHtHtHt ^ RIHt ^ RIHt ^ RI	H
t
Ht ^ RIHtHtHt ^ RIHt ^ RIHt ^ RIHt ]! R	4      t]! R
4      t]'       d   ]'       d   ^ RIHt ^ RIHt  ! R R]4      tR# )z!
Tests for L{twisted.conch.tap}.
)ÚAnyÚTupleÚUnion)ÚStreamServerEndpointService)Úerror)ÚFilePasswordDBÚICredentialsChecker)ÚISSHPrivateKeyÚIUsernamePasswordÚUsernamePassword©ÚDeferred)ÚrequireModule)ÚTestCaseÚcryptographyztwisted.conch.unix)Útap)ÚOpenSSHFactoryc                   óà   a € ] tR t^t o Rt]'       g   Rt]'       g   RtRtV 3R lR lt	V 3R lR lt
V 3R lR	 ltV 3R
 lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )ÚMakeServiceTestsz
Tests for L{tap.makeService}.
zcan't run without cryptographyz can't run on non-posix computersc                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnN© )ÚformatÚ__classdict__s   "€Ú=/usr/lib/python3/dist-packages/twisted/conch/test/test_tap.pyÚ__annotate__ÚMakeServiceTests.__annotate__(   s   ø€ ÷ %ñ %�tñ %ó    c                ó,  € V P                  4       V n        \        V P                  R4      ;_uu_ 4       pVP                  RP	                  V P
                  4      4       RRR4       \        P                  ! 4       V n        R#   + '       g   i     L,; i)z
Create a file with two users.
zwb+ó   :N)	ÚmktempÚfilenameÚopenÚwriteÚjoinÚusernamePasswordr   ÚOptionsÚoptions)ÚselfÚfs   & r   ÚsetUpÚMakeServiceTests.setUp(   sZ   € ð Ÿ™›ˆŒÜ�$—-‘- ×'Ô'¨1Ø�G‰G�D—I‘I˜d×3Ñ3Ó4Ô5÷ (ä—{’{“}ˆŽ÷ (×'ús   ´+BÂB	c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r   1   s   ø€ ÷ 
?ñ 
?˜Dñ 
?r   c                ó  € \         P                  ! 4       p\         P                  ! V4      pV P                  V\        4       V P                  VP                  P                  ^4       V P                  VP                  \        4       R# )z£
L{tap.makeService} returns a L{StreamServerEndpointService} instance
running on TCP port 22, and the linked protocol factory is an instance
of L{OpenSSHFactory}.
N)
r   r(   ÚmakeServiceÚassertIsInstancer   ÚassertEqualÚendpointÚ_portÚfactoryr   )r*   ÚconfigÚservices   &  r   Ú
test_basicÚMakeServiceTests.test_basic1   s^   € ô —’“ˆÜ—/’/ &Ó)ˆØ×Ñ˜gÔ'BÔCØ×Ñ˜×)Ñ)×/Ñ/°Ô4Ø×Ñ˜gŸo™o¬~Ö>r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r   =   s   ø€ ÷ 
ñ 
 4ñ 
r   c                ó  € ^pV P                  \        V P                  R,          R4       V P                  \        V P                  R,          R4       V P	                  V\        V P                  R,          4      RV3,          4       R# )z‰
Make sure that if the C{--auth} command-line option is not passed,
the default checkers are (for backwards compatibility): SSH and UNIX
ÚcredInterfacesz)SSH should be one of the default checkersz*UNIX should be one of the default checkersÚcredCheckersz&There should be %d checkers by defaultN)ÚassertInr	   r)   r
   r2   Úlen)r*   ÚnumCheckerss   & r   Útest_defaultAuthsÚ"MakeServiceTests.test_defaultAuths=   sw   € ð
 ˆà�‰ÜØ�L‰LÐ)Õ*Ø7ô	
ð
 	�‰ÜØ�L‰LÐ)Õ*Ø8ô	
ð
 	×ÑØÜ�—‘˜^Õ,Ó-Ø4¸°~ÕEö	
r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r   T   s   ø€ ÷ ?ñ ? ñ ?r   c                óº   € V P                   P                  RRV P                  ,           .4       V P                  \	        V P                   R,          4      ^4       R# )zv
The C{--auth} command-line option will add a checker to the list of
checkers, and it should be the only auth checker
ú--authúfile:r=   N©r)   ÚparseOptionsr#   r2   r?   ©r*   s   &r   Útest_authAddedÚMakeServiceTests.test_authAddedT   sB   € ð
 	�‰×!Ñ! 8¨W°t·}±}Õ-DÐ"EÔFØ×Ñœ˜TŸ\™\¨.Õ9Ó:¸AÖ>r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r   \   s   ø€ ÷ ?ñ ?¨ñ ?r   c                ó¾   € V P                   P                  RRV P                  ,           RR.4       V P                  \	        V P                   R,          4      ^4       R# )z­
Multiple C{--auth} command-line options will add all checkers specified
to the list ofcheckers, and there should only be the specified auth
checkers (no default checkers).
rE   rF   zmemory:testuser:testpasswordr=   NrG   rI   s   &r   Útest_multipleAuthAddedÚ'MakeServiceTests.test_multipleAuthAdded\   sP   € ð 	�‰×!Ñ!àØ˜$Ÿ-™-Õ'ØØ.ð	ô	
ð 	×Ñœ˜TŸ\™\¨.Õ9Ó:¸AÖ>r   c                ó    <€ V ^8„  d   QhRS[ /# )r   r   )r   )r   r   s   "€r   r   r   l   s   ø€ ÷ 
ñ 
¡#ñ 
r   c                óV  € V P                   P                  RRV P                  ,           .4       V P                   R,          R,          pV P                  V\        4       \        V P                  ^ ,          R4      pV P                  VP                  V4      \        P                  4      # )z·
The checker created by the C{--auth} command-line option returns a
L{Deferred} that fails with L{UnauthorizedLogin} when
presented with credentials that are unknown to that checker.
rE   rF   r=   s   fakeéÿÿÿÿ)r)   rH   r#   r1   r   r   r'   ÚassertFailureÚrequestAvatarIdr   ÚUnauthorizedLogin)r*   ÚcheckerÚinvalids   &  r   Útest_authFailureÚ!MakeServiceTests.test_authFailurel   s‡   € ð 	�‰×!Ñ! 8¨W°t·}±}Õ-DÐ"EÔFØ"&§,¡,¨~Õ">¸rÕ"BˆØ×Ñ˜g¤~Ô6Ü" 4×#8Ñ#8¸Õ#;¸WÓEˆà×!Ñ!Ø×#Ñ# GÓ,¬e×.EÑ.Eó
ð 	
r   c                ó.   <€ V ^8„  d   QhRS[ R,          /# r   r   )r   r   s   "€r   r   r   {   s   ø€ ÷ +ñ +¡(¨4¥.ñ +r   c                ó  a a€ S P                   P                  RRS P                  ,           .4       S P                   R,          R,          p\        S P                  !  oVP                  S4      pR VV 3R llpVP                  V4      # )z«
The checker created by the C{--auth} command-line option returns a
L{Deferred} that returns the avatar id when presented with credentials
that are known to that checker.
rE   rF   r=   c                óX   € V ^8„  d   QhR\         \        \        R,          3,          RR/# )r   Úusernamer   Nr   )r   Úbytesr   )r   s   "r   r   Ú7MakeServiceTests.test_authSuccess.<locals>.__annotate__†   s(   € ÷ 	9ñ 	9¤5¬´°bµ	Ð)9Õ#:ð 	9¸tñ 	9r   c                 ó@   <€ SP                  V SP                  4       R # )N)r2   r]   )r]   Úcorrectr*   s   &€€r   ÚcheckSuccessÚ7MakeServiceTests.test_authSuccess.<locals>.checkSuccess†   s   ø€ Ø×Ñ˜X w×'7Ñ'7Ö8r   rR   )r)   rH   r#   r   r'   rT   ÚaddCallback)r*   rV   Údrb   ra   s   f   @r   Útest_authSuccessÚ!MakeServiceTests.test_authSuccess{   ss   ù€ ð 	�‰×!Ñ! 8¨W°t·}±}Õ-DÐ"EÔFØ'+§|¡|°NÕ'CÀBÕ'GˆÜ" D×$9Ñ$9Ñ:ˆØ×#Ñ# GÓ,ˆ÷	9ñ 	9ð �}‰}˜\Ó*Ð*r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r   ‹   s   ø€ ÷ 
ñ 
˜tñ 
r   c                ó  € \         P                  ! 4       p\         P                  ! V4      pVP                  P                  pV P                  \        VP                  P                  4       4      \        \        04       R# )z“
The L{OpenSSHFactory} built by L{tap.makeService} has a portal with
L{ISSHPrivateKey} and L{IUsernamePassword} interfaces registered as
checkers.
N)r   r(   r0   r5   Úportalr2   ÚsetÚcheckersÚkeysr	   r
   )r*   r6   r7   rj   s   &   r   Útest_checkersÚMakeServiceTests.test_checkers‹   sW   € ô —’“ˆÜ—/’/ &Ó)ˆØ—‘×'Ñ'ˆØ×ÑÜ�—‘×$Ñ$Ó&Ó'¬.Ô:KÐ)Lö	
r   )r#   r)   N)s   iamusers   thisispassword)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚskipÚunixr'   r,   r8   rA   rJ   rN   rX   rf   rn   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      sr   ø‡ € ñ÷ Ø/ˆçØ1ˆà6Ð÷%ð %÷
?ð 
?÷
ð 
÷.?ð ?÷?ð ?÷ 
ð 
÷+ð +÷ 
ö 
r   r   N)rt   Útypingr   r   r   Útwisted.application.internetr   Útwisted.credr   Útwisted.cred.checkersr   r   Útwisted.cred.credentialsr	   r
   r   Útwisted.internet.deferr   Útwisted.python.reflectr   Útwisted.trial.unittestr   r   rv   Útwisted.conchr   Ú$twisted.conch.openssh_compat.factoryr   r   r   r   r   Ú<module>rƒ      sZ   ðñ÷ %Ñ $å DÝ ß Eß XÑ XÝ +Ý 0Ý +á˜^Ó,€ÙÐ)Ó*€÷ —DÝ!ÝCô{
�xö {
r   