
    bZ                         d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZm	Z	m
Z
 d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ  G d	 d
e          ZdS )    N)SambaToolCmdTest)credentialsnttime2unixdsdbwerror)
ndr_unpack)drsblobs)	get_bytes)
get_string)env_loadparmc                        e Zd ZdZg ZdZ fdZ fdZd Zd Z		 	 d$d	Z
d
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zi fdZi fdZi fdZd Zd Zd Z d  Z!d! Z"d" Z#d# Z$ xZ%S )%UserCmdTestCasez%Tests for samba-tool user subcommandsNc           	      T   t          t          |                                            |                     ddt          j        d         z  dt          j        d         dt          j        d                   | _        |                                 }|                    d          | _	        |
                    dd	           g | _        | j                            |                     d
dd                     | j                            |                     ddd                     | j                            |                     ddd                     | j                            |                     ddd                     | j                            |                     ddi                     | j                            |                     ddi                     | j                            |                     ddi                     | j                            |                     ddi                     | j                            |                     ddi                     | j                            |                     ddi                     | j                            |                     ddi                     | j                            |                     ddi                     | j        D ]} |d         |          \  }}}|                     |||           |                     |dd           d|d         v r |                     d|d         z  |           n|                     d|d         z  |            |d          |           d S )!N-H	ldap://%s	DC_SERVER-UDC_USERNAME%DC_PASSWORDtemplate homedirz/home/test/%D/%U
sambatool1comp1)namecompany
sambatool2
sambatool3comp2
sambatool4r   
posixuser1
posixuser2
posixuser3
posixuser4	unixuser1	unixuser2	unixuser3	unixuser4createUserFn Shouldn't be any error messagesunixzModified User '%s' successfullyUser '%s' added successfullycheckUserFn)superr   setUpgetSamDBosenvironsamdbget_loadparmgettemplate_homedirsetusersappend_randomUser_randomPosixUser_randomUnixUserassertCmdSuccessassertEqualassertIn)selflpuserresultouterr	__class__s         =/usr/lib/python3/dist-packages/samba/tests/samba_tool/user.pyr/   zUserCmdTestCase.setUp)   s   ot$$**,,,]]4rz+7N)N)N13M1J1J1JBJWdLeLe#fh h
    "'9 : :
!#5666

$**LW+U+UVVWWW
$**LW+U+UVVWWW
$**LW+U+UVVWWW
$**LW+U+UVVWWW
$//0FGGHHH
$//0FGGHHH
$//0FGGHHH
$//0FGGHHH
$../DEEFFF
$../DEEFFF
$../DEEFFF
$../DEEFFF J 	& 	&D!5n!5d!;!;VS#!!&#s333S"&GHHHf%%?$v,N!# # # # <tF|K!# # #  D%%%%	& 	&    c                    t          t          |                                            | j        D ]:}|                     |d                   r|                     dd|d                    ;t                      }|                    d          }t          j	        
                    |          rt          j        |           |                    d| j                   d S )Nr   rB   deletezuser-syncpasswords-cache.ldbr   )r.   r   tearDownr8   
_find_user	runsubcmdr   private_pathr1   pathexistsremover7   r6   )r@   rB   rA   cachedbrF   s       rG   rK   zUserCmdTestCase.tearDownP   s    ot$$--///J 	? 	?DtF|,, ?vxf>>>^^ //"@AA7>>'"" 	Ig
!4#899999rH   c                 p   | j         D ]G}|                     |          \  }}}|                     |d           |                     d|           H| j         D ]k}|                     dd|d                   \  }}}|                     |||d           |                     |d                   }|                     |           l| j         D ]j}|                     dd|d         |d         d	d
|d         z  d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  ddt          j	        d         z  dt          j	        d         dt          j	        d                   \  }}}|                     |||           | 
                    |dd           |                     d|d         z  |           |                     |d                   }| 
                    d |                    d!          z  d"|z             | 
                    d |                    d          z  d"|z             ld S )#NzEnsure that create user failsz'LDAP error 68 LDAP_ENTRY_ALREADY_EXISTSrB   rJ   r   zCan we delete userscreatepasswordz--use-username-as-cn--surname=%ssurname--given-name=%s
given-name--job-title=%s	job-title--department=%s
department--description=%sdescription--company=%sr   r   r   r   r   r   r   r   r)   r*   r,   %scnz%(name)s)r8   _create_userassertCmdFailr?   rM   r=   rL   assertIsNoner1   r2   r>   r5   )r@   rB   rC   rD   rE   founds         rG   test_newuserzUserCmdTestCase.test_newuser_   sl   J 	J 	JD!%!2!24!8!8VS#v'FGGGMMCSIIII J 	% 	%D!%$v,!O!OVS#!!&#s4IJJJOODL11Ee$$$$ J 	J 	JD!%$v,PTU_P`0F0>i0P0ADDV0V0@4CT0T0ADDV0V0BT-EX0X0>i0P04kBJ{D[6[6[>@j>W>W>WY[YcdqYrYr0s	"u 	"uVS# !!&#s333S"&GHHHMM84<GMMMOODL11ETEIIdOO3Z$5FGGGTEIIf$5$55zD7HIIII'	J 	JrH   c                      fd}t           j        d         }t           j        d         }t           j        d         }                                 }d}                     ||                                dd||dd	| d
| d|           \  }}}	                     |                                d|	                                d|	                                t          j        d|	            j	        
                     j	                                        d| dt          j                  }
                     dt          |
          d           d S )Nc                     	 j                             |            d S # t          $ r}|j        d         }d|vr Y d }~d S d }~ww xY w)Nr   Unable to find user)r3   
deleteuser	Exceptionargs)usernamerE   estrr@   s      rG   cleanup_userz@UserCmdTestCase.test_newuser_weak_password.<locals>.cleanup_user   sp    
%%h/////   x{(44 544444s    
AAAr   r   r   arB   addr   zldap://r   r   zFailed to add userLDAP_CONSTRAINT_VIOLATION08Xz(sAMAccountName=))
expressionscoper   zexpected not to find the user)r1   r2   
randomName
addCleanuprM   rd   r?   r   WERR_PASSWORD_RESTRICTIONr3   search	domain_dnldbSCOPE_SUBTREEr>   len)r@   rp   serverdc_usernamedc_passwordrn   rU   rC   rD   rE   ress   `          rG   test_newuser_weak_passwordz*UserCmdTestCase.test_newuser_weak_password   sx   
	 	 	 	 	 K(j/j/??$$h///  >>&%*2H*.0B&0B0B*J{*J*J[*J*JL LS 	6"""*C000137779??EEE j
 4 4 6 6+Ih+I+I+I&)&7   9 9 	CHH&EFFFFFrH         c                 f   | j                             |          }t          |          \  }}|                     d|d           |d         d         }t	          t
          j        |          }|                     |j        j	        |d           | 
                    |j        j	        |d           |dk    rd S dd}	d}
 |	|j        j        d|
          \  }}|                     |d	           |                     |d
z   |j        j	        d
z
  d            |	|j        j        d|
          \  }}|'|                     ||
d           |
d
z   }
|
|k    r|
d
z   }
 |	|j        j        d|
          \  }}|                     |d           |                     ||
d           |
d
z   }
|
|k    r|
d
z   }
 |	|j        j        d|
          \  }}|                     |d           |                     ||
d           |
d
z   }
|
|k    r|
d
z   }
 |	|j        j        d|
          \  }}|'|                     ||
d           |
d
z   }
|
|k    r|
d
z   }
 |	|j        j        d|
          \  }}|'|                     ||
d           |
d
z   }
|
|k    r|
d
z   }
|                     |
|j        j	        d           d S )NsupplementalCredentialsz*supplementalCredentials attribute requiredr   zmin_packages checkzmax_packages checkc                     t          |t          |                     D ]}| |         j        |k    r|| |         fc S  dS )N)NN)ranger   r   )packagesr   	start_idxis       rG   find_packagezEUserCmdTestCase._verify_supplementalCredentials.<locals>.find_package   sR    9c(mm44 , ,A;#t++x{++++ ,<rH   Packages)r   zPackages required   z(Packages needs to be at num_packages - 1zPrimary:Kerberos-Newer-Keysz-Primary:Kerberos-Newer-Keys at wrong positionzPrimary:KerberoszPrimary:Kerberos requiredz"Primary:Kerberos at wrong positionzPrimary:WDigestzPrimary:WDigest requiredz!Primary:WDigest at wrong positionzPrimary:CLEARTEXTz#Primary:CLEARTEXT at wrong positionzPrimary:SambaGPGz"Primary:SambaGPG at wrong positionzUnknown packages found)r   )r3   
parse_ldifnextr?   r   r	   supplementalCredentialsBlobassertGreaterEqualsubnum_packagesassertLessEqualr   assertIsNotNoner>   )r@   ldifmin_packagesmax_packagesmsgs
changetypeobjsc_blobscr   nidxpidxppknidxknpkidxkpwidxwpcidxcpgidxgps                          rG   _verify_supplementalCredentialsz/UserCmdTestCase._verify_supplementalCredentials   sm    z$$T** JJS/6bccc/03<gFF 3 ,.B	D 	D 	DRV0)+?	A 	A 	A 1F	  	  	  	 " !\"&/:NNN
rR!455526#6#:C	E 	E 	E $|BFO5R.24 4 4UD*YZZZ!8Dt||ax!\"&/3E,02 2 2
rR!<===t%IJJJax4<<!8D!\"&/3D,02 2 2
rR!;<<<t%HIIIax4<<!8D!\"&/3F,02 2 2
rT4)NOOO!8Dt||ax!\"&/3E,02 2 2
rT4)MNNN!8Dt||axrv24LMMMMMrH   c                    t          t          t          j                            dd                              }| j        D ]}|                     d          }|                     dd|d         d|z  dd	t          j        d
         z  dt          j        d         dt          j        d                   \  }}}|                     |||d           | 	                    |dd           | 
                    |dd           d}|                     dddd|z  d          \  }}}|                     |||d           | 	                    |dd           ddii i i ddii i i d}|                                D ]D}	||	                             dd          }
| 
                    ||	d|
d|	d|
d |d!           E|                     ddd"          \  }}}|                     |||d#           | 	                    |dd$           | 
                    |d%d&|z             | j        D ]/}| 
                    |d'|d         z  d(|d         d |d!           0| j        D ]P}|                     d          }t          j                    }|                                 |                    |           t!          j        |                                                              d)          }t!          j        t)          |                                        d)          }t!          j        t+          |                              d*                                        d)          }|                     dd|d         d|z            \  }}}|                     |||d           | 	                    |dd+           | 
                    |dd+           |                     ddd"          \  }}}|                     |||d#           | 	                    |dd$           | 
                    |d%d&|z             | 
                    |d'|d         z  d(|d         d |d!           | 
                    |d,d-|z             |r| 
                    |d.|z  d/|z             n|                     d.|z  |           | 
                    |d0d1|z             | 
                    |d2d3|z             d4|v rT| 
                    |d5|z  d6|z             | 
                    |d7|z  d8|z             | 
                    |d9d:|z             |                     dd;|d         d|z  d          \  }}}|                     |||d<           | 	                    |dd           | 
                    |d=d           | 
                    |d'|d         z  d>|d         d |d!           |r| 
                    |d.|z  d/|z             n|                     d.|z  |           | 
                    |d2d3|z             |                     |                    d?d                     d4|v rT| 
                    |d5|z  d6|z             | 
                    |d7|z  d8|z             | 
                    |d9d:|z             R| j        D ]}|                     d          }|                     dd|d         d|z  d@dd	t          j        d
         z  dt          j        d         dt          j        d                   \  }}}|                     |||d           | 	                    |ddA           | 
                    |ddA           d S )BNEXPECT_NT_HASH1   rB   setpasswordr   z--newpassword=%sr   r   r   r   r   r   r   zEnsure setpassword runsr)   zsetpassword with urlzChanged password OKzxsAMAccountName,unicodePwd,supplementalCredentials,virtualClearTextUTF8,virtualClearTextUTF16,virtualSSHA,virtualSambaGPGsyncpasswordsz--cache-ldb-initialize--attributes=%sz--decrypt-samba-gpgz0Ensure syncpasswords --cache-ldb-initialize runszgetpassword without urlvalueuserSyncPasswordszdirsync:1:0:0)objectClasssamdbUrldirsyncFilterdirsyncAttributedirsyncControlpasswordAttributedecryptSambaGPGcurrentTimez: z&syncpasswords --cache-ldb-initialize: z out[]z	--no-waitz#Ensure syncpasswords --no-wait runszsyncpasswords --no-waitzdirsync_loop(): results 0z=syncpasswords --no-wait: 'dirsync_loop(): results 0': out[%s]zsAMAccountName: %sz+syncpasswords --no-wait: 'sAMAccountName': utf8z	utf-16-lezsetpassword without urlz)# unicodePwd::: REDACTED SECRET ATTRIBUTEz@getpassword '# unicodePwd::: REDACTED SECRET ATTRIBUTE': out[%s]zunicodePwd:: %szgetpassword unicodePwd: out[%s]z6# supplementalCredentials::: REDACTED SECRET ATTRIBUTEzMgetpassword '# supplementalCredentials::: REDACTED SECRET ATTRIBUTE': out[%s]zsupplementalCredentials:: z,getpassword supplementalCredentials: out[%s]zvirtualSambaGPG:: zvirtualClearTextUTF8:: %sz)getpassword virtualClearTextUTF8: out[%s]zvirtualClearTextUTF16:: %sz*getpassword virtualClearTextUTF16: out[%s]zvirtualSSHA: z getpassword virtualSSHA: out[%s]getpasswordzEnsure getpassword runszGot password OKzgetpassword: 'sAMAccountName': z
Got password OK
z--must-change-at-next-loginzsetpassword with forced change)boolintr1   r2   r5   r8   random_passwordrM   r=   r>   assertMatchkeysr   Credentialsset_anonymousset_passwordbase64	b64encodeget_nt_hashdecoder
   r   encodeassertNotInr   replace)r@   expect_nt_hashrB   	newpasswdrC   rD   rE   
attributescache_attrsrq   vcreds
unicodePwdvirtualClearTextUTF8virtualClearTextUTF16s                  rG   test_setpasswordz UserCmdTestCase.test_setpassword   s{	   c"*..1A3"G"GHHIIJ 		Q 		QD,,R00I!%04V0BY0N04kBJ{D[6[6[>@j>W>W>WY[YcdqYrYr0s	"u "uVS#
 !!&#s4MNNNS"&<===S"79OPPPP P
!^^FO,D,=
,J,AC Cc 	fc30bcccb";<<<#%89 "&8!#!	
 	
 !!## 	c 	cAA""7B//ASaaa"3"3WXWXWXZ[Z[Z[]`]`]`ac c c c "^^FO[QQcfc30UVVVb";<<<9X\_`	b 	b 	bJ 	l 	lDS"6$v,"G"GX\]cXdXdXdfififijl l l l J A	K A	KD,,R00I+--E!!!y))))%*;*;*=*=>>EEfMMJ#)#3Ii4H4H#I#I#P#PQW#X#X $*$4Z	5J5J5Q5QR]5^5^$_$_$f$fgm$n$n!!%04V0BY0N"P "PVS# !!&#s4MNNNS"&?@@@S"79RSSS!%!U!UVS#!!&#s4YZZZS"&?@@@S"=\`cdf f fS"6$v,"G"GX\]cXdXdXdfififijl l lS"M_beeg g g F  &7*&D!BS!HJ J J J   !2Z!?EEES"Zlorrt t tS">KcQS S S#s**  &ADX&X!Ls!RT T T  &BEZ&Z!MPS!SU U U  o!Cc!IK K K "&04V0AJ0N0E"G "GVS# !!&#s4MNNNS"&?@@@S"35NOOOS"6$v,"G"GLPQWLLLZ]Z]Z]^` ` ` F  &7*&D!BS!HJ J J J   !2Z!?EEES">KcQS S S00=RTV1W1WXXX#s**  &ADX&X!Ls!RT T T  &BEZ&Z!MPS!SU U U  o!Cc!IK K K J 
	[ 
	[D,,R00I!%04V0BY0N0M04kBJ{D[6[6[>@j>W>W>WY[YcdqYrYr0s"u "uVS# !!&#s4MNNNS"&FGGGS"79YZZZZ
	[ 
	[rH   c                 @   | j         D ]}t          j                    dz   }|                     dd|d         dddt          j        d         z  d	t          j        d
         dt          j        d                   \  }}}|                     |||d           |                     d|d         z  |           |                     |d                   }t          t          d|
                    d          z                      }|                     ||dd           	 d S )Ni  rB   	setexpiryr   z--days=2r   r   r   r   r   r   r   zCan we run setexpiry with namesz#Expiry for user '%s' set to 2 days.ra   accountExpires   z?Ensure account expires is within 5 seconds of the expected time)r8   timerM   r1   r2   r=   r?   rL   r   r   r5   assertWithin)	r@   rB   twodaysrC   rD   rE   rf   expiresfourdayss	            rG   test_setexpiryzUserCmdTestCase.test_setexpiryx  s%   J 	v 	vDikk%56G!%T&\0:04kBJ{D[6[6[>@j>W>W>WY[YcdqYrYr0s"u "uVS# !!&#s4UVVVMM?$v,NPSTTTOODL11E!#dUYY7G-H-H&H"I"IJJGgw3tuuuu	FrH   c                 l   |                      ddddt          j        d         z  dt          j        d         dt          j        d	                   \  }}}|                     |||d
           dt          j        t          j        fz  }| j        	                    | j        
                                t          j        |dg          }|                     t          |          dk    d           |D ]@}t          |                    dd                    }|                     ||d|z            }Ad S )NrB   listr   r   r   r   r   r   r   Error running list0(&(objectClass=user)(userAccountControl:%s:=%u))samaccountnamebaserw   rv   attrsr   no users found in samdbidxuser '%s' not foundrM   r1   r2   r=   r}   OID_COMPARATOR_ANDr   UF_NORMAL_ACCOUNTr3   r{   r|   r~   
assertTruer   strr5   r   	r@   rC   rD   rE   search_filteruserlistuserobjr   rf   s	            rG   	test_listzUserCmdTestCase.test_list  sN   !^^FF,0+
;@W2W2W:<*]:S:S:S:<*]:S:S-UV Vc 	fc30DEEEK0$2HIJ :$$$**>*>*@*@+.+<0=,<+= % ? ?
 	H)+DEEE 	C 	CGw{{#3{;;<<D$$S$%:T%AC CEE	C 	CrH   c                 v   d}|                      ddd|ddt          j        d         z  dt          j        d	         d
t          j        d                   \  }}}|                     |||d           dt          j        t          j        fz  }| j        	                    | j        
                    |          t          j        |dg          }|                     t          |          dk    d           |D ]@}t          |                    dd                    }|                     ||d|z            }	Ad S )NzCN=UsersrB   r   z-br   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )rM   r1   r2   r=   r}   r   r   r   r3   r{   normalize_dn_in_domainr~   r   r   r   r5   r   )
r@   base_dnrC   rD   rE   r   r   r   r   rf   s
             rG   test_list_base_dnz!UserCmdTestCase.test_list_base_dn  sY   !^^FFD',0+
;@W2W2W:<*]:S:S:S:<*]:S:S-UV Vc 	fc30DEEEK0$2HIJ :$$$**K*KG*T*T+.+<0=,<+= % ? ?
 	H)+DEEE 	C 	CGw{{#3{;;<<D$$S$%:T%AC CEE	C 	CrH   c                 n   |                      dddddt          j        d         z  dt          j        d         d	t          j        d
                   \  }}}|                     |||d           dt          j        t          j        fz  }| j        	                    | j        
                                t          j        |dg          }|                     t          |          dk    d           |D ]@}t          |                    dd                    }|                     ||d|z            }Ad S )NrB   r   z	--full-dnr   r   r   r   r   r   r   r   r   dnr   r   r   r   r   r   r   s	            rG   test_list_full_dnz!UserCmdTestCase.test_list_full_dn  sN   !^^FFK,0+
;@W2W2W:<*]:S:S:S:<*]:S:S-UV Vc 	fc30DEEEK0$2HIJ :$$$**>*>*@*@+.+<0=,06 % 3 3
 	H)+DEEE 	C 	CGw{{4Q{//00D$$S$%:T%AC CEE	C 	CrH   c                    d}|                      d|i          }|                     |           |                     dddddt          j        d         z  d	t          j        d
         dt          j        d                   \  }}}|                     |||d           |                     ||v d|z             | j                            d|z  dd           |                     dddddt          j        d         z  d	t          j        d
         dt          j        d                   \  }}}|                     |||d           | 	                    ||v d|z             | j        
                    |           d S )N
expireUserr   rB   r   z--hide-expiredr   r   r   r   r   r   r   r   r   (sAMAccountname=%s)Fuser '%s' found)r:   rc   rM   r1   r2   r=   r   r3   r   assertFalserk   )r@   expire_usernameexpire_userrC   rD   rE   s         rG   test_list_hide_expiredz&UserCmdTestCase.test_list_hide_expired  s   &&&'@AA+&&&!^^"*[111*]333*]3356 6c 	fc30DEEE3.-?	A 	A 	A 	
!O3	 	 	
 "^^"*[111*]333*]3356 6c 	fc30DEEEC/*_<	> 	> 	> 	
o.....rH   c                    d}|                      d|i          }|                     |           |                     dddddt          j        d         z  d	t          j        d
         dt          j        d                   \  }}}|                     |||d           |                     ||v d|z             | j                            d|z             |                     dddddt          j        d         z  d	t          j        d
         dt          j        d                   \  }}}|                     |||d           | 	                    ||v d|z             | j        
                    |           d S )NdisableUserr   rB   r   z--hide-disabledr   r   r   r   r   r   r   r   r   r  r  )r:   rc   rM   r1   r2   r=   r   r3   disable_accountr  rk   )r@   disable_usernamedisable_userrC   rD   rE   s         rG   test_list_hide_disabledz'UserCmdTestCase.test_list_hide_disabled  s   (''1A(BCC,'''!^^"*[111*]333*]3356 6c 	fc30DEEE(C/-0@@	B 	B 	B 	
""#8;K#KLLL!^^"*[111*]333*]3356 6c 	fc30DEEE)S0*-==	? 	? 	? 	
./////rH   c                    | j         D 
]}|                     dd|d         dddt          j        d         z  dt          j        d	         d
t          j        d                   \  }}}|                     |||d           d|d         d|d         d| j                                        d|d         d|d         d}|                     ||d|d         z             g d}g }|D ]6}|                    |           dD ]}	|                    |d|	           7|                     dd|d         dd	                    |          z  ddt          j        d         z  dt          j        d	         d
t          j        d                   \  }}}|                     |||d           | 
                    d|           | 
                    d|           | 
                    d|           | 
                    d|           |                     d |           |                     d!|           |                     d"|           | 
                    d#|           | 
                    d$|           | 
                    d%|           | 
                    d&|           | 
                    d'|           | 
                    d(|           | 
                    d)|           | 
                    d*|           | 
                    d+|           |                     d,|           |                     d-|           |                     d.|           | 
                    d/|           |                     d0|           |                     d1|           |                     d2|           | 
                    d3|           |                     d4|           |                     d5|           |                     d6|           | 
                    d7|           |                     d8|           |                     d9|           |                     d:|           |                     d;|           |                     d<|           | 
                    d=|           | 
                    d>|           | 
                    d?|           | 
                    d@|           | 
                    dA|           | 
                    dB|           | 
                    dC|           | 
                    dD|           | j                            |          }
t          |
          dE         }| 
                    dF|           t          |dF         dG                   }| 
                    dH|           |                     t          |dH         dG                   |           t          j        |          }| 
                    dI|           |                     t          |dI         dG                   t          |                     | 
                    dJ|           |                     t          |dJ         dG                   dK|z             | 
                    dL|           t          |dL         dG                   }| 
                    dM|           |                     t          |dM         dG                   |           t          j        |          }| 
                    dN|           |                     t          |dN         dG                   t          |                     | 
                    dO|           |                     t          |dO         dG                   dK|z             | 
                    dP|           t          |dP         dG                   }t          j        |          }| 
                    dQ|           |                     t          |dQ         dG                   t          |                     | 
                    dR|           | 
                    dS|z  t          |dR         dG                              |                     dTt          |dR         dG                              |                     ||           |                     ||dUz              | 
                    dV|           t          |dV         dG                   }t          j        |          }| 
                    dW|           |                     t          |dW         dG                   t          |                     | 
                    dX|           | 
                    dS|z  t          |dX         dG                              |                     dTt          |dX         dG                              |                     ||           
d S )YNrB   showr   z#--attributes=sAMAccountName,companyr   r   r   r   r   r   r   zError running showzdn: CN=rY    rW   z
,CN=Users,z

company: r   z
sAMAccountName: z

z$Unexpected show output for user '%s')r   whenCreatedwhenChangedr   badPasswordTime
lastLogoff	lastLogonlastLogonTimestamplockoutTimez#msDS-UserPasswordExpiryTimeComputed
pwdLastSet)GeneralizedTimeUnixTimeTimeSpecz;format=r   ,z;format=GeneralizedTimez;format=UnixTimez;format=TimeSpeczname: zname;format=GeneralizedTime: zname;format=UnixTime: zname;format=TimeSpec: zwhenCreated: 20z&whenCreated;format=GeneralizedTime: 20zwhenCreated;format=UnixTime: 1zwhenCreated;format=TimeSpec: 1zwhenChanged: 20z&whenChanged;format=GeneralizedTime: 20zwhenChanged;format=UnixTime: 1zwhenChanged;format=TimeSpec: 1z#accountExpires: 9223372036854775807z'accountExpires;format=GeneralizedTime: z accountExpires;format=UnixTime: z accountExpires;format=TimeSpec: zbadPasswordTime: 0z(badPasswordTime;format=GeneralizedTime: z!badPasswordTime;format=UnixTime: z!badPasswordTime;format=TimeSpec: zlastLogoff: 0z#lastLogoff;format=GeneralizedTime: zlastLogoff;format=UnixTime: zlastLogoff;format=TimeSpec: zlastLogon: 0z"lastLogon;format=GeneralizedTime: zlastLogon;format=UnixTime: zlastLogon;format=TimeSpec: zlastLogonTimestamp:zlockoutTime:z&msDS-UserPasswordExpiryTimeComputed: 1z>msDS-UserPasswordExpiryTimeComputed;format=GeneralizedTime: 20z6msDS-UserPasswordExpiryTimeComputed;format=UnixTime: 1z6msDS-UserPasswordExpiryTimeComputed;format=TimeSpec: 1zpwdLastSet: 1z%pwdLastSet;format=GeneralizedTime: 20zpwdLastSet;format=UnixTime: 1zpwdLastSet;format=TimeSpec: 1r   r  r   z"whenCreated;format=GeneralizedTimezwhenCreated;format=UnixTimezwhenCreated;format=TimeSpecz%d.000000000r  z"whenChanged;format=GeneralizedTimezwhenChanged;format=UnixTimezwhenChanged;format=TimeSpecz!pwdLastSet;format=GeneralizedTimezpwdLastSet;format=UnixTimezpwdLastSet;format=TimeSpecz%d.z
.000000000<   z:msDS-UserPasswordExpiryTimeComputed;format=GeneralizedTimez3msDS-UserPasswordExpiryTimeComputed;format=UnixTimez3msDS-UserPasswordExpiryTimeComputed;format=TimeSpec)r8   rM   r1   r2   r=   r3   r|   r>   r9   joinr?   r   r   r   r   r}   string_to_timer   
assertLessassertGreater)r@   rB   rC   rD   rE   expected_out
time_attrsr   tafmout_msgsout_msgwhen_created_strwhen_created_timewhen_changed_strwhen_changed_timepwd_last_set_strpwd_last_set_timepwd_expires_strpwd_expires_times                       rG   	test_showzUserCmdTestCase.test_show(  s!
   J V	D V	DD!%V5kBJ{$;;; j777 j779	": ":VS# !!&#s4HIIII L4	???DJ,@,@,B,B,B,BYf/L S,C!&\*+ + +  J E  < <R   E < <BLL222rr!:;;;;< "&V!CHHUOO3kBJ{$;;; j777 j779	": ":VS# !!&#s4HIIIMM3S999MM,c222MM,c222MM(C(((<cBBB5s;;;5s;;;MM+S111MMBCHHHMM:C@@@MM:C@@@MM+S111MMBCHHHMM:C@@@MM:C@@@MM?EEEFLLL?EEE?EEEMM.444GMMM@#FFF@#FFFMM/3///BCHHH;SAAA;SAAAMM.#...A3GGG:C@@@:C@@@ 2C888^S111MMBCHHHMMZ\_```MMRTWXXXMMRTWXXXMM/3///MMA3GGGMM93???MM93???z,,S11H8nnQ'GMM-111"7=#9!#<==MM>HHHS)M!Nq!QRRTdeee # 23C D DMM7AAAS)F!G!JKKSQbMcMcdddMM7AAAS)F!G!JKK+/@AC C C MM-111"7=#9!#<==MM>HHHS)M!Nq!QRRTdeee # 23C D DMM7AAAS)F!G!JKKSQbMcMcdddMM7AAAS)F!G!JKK+/@AC C C MM=wGGG"7+N#OPQ#RSS # 23C D DMM6@@@S)E!Fq!IJJCPaLbLbcccMM6@@@MM%"33SA]9^_`9a5b5bccc\3w7S/TUV/W+X+XYYY ##$57HIIIOO-/@2/EFFFMMVX_```!'*f"ghi"jkkO"1/BBMMOQXYYYS)^!_`a!bccehiyezez{{{MMOQXYYYMM%"22C@u8vwx8y4z4z{{{\3w7l/mno/p+q+qrrr /1BCCCCmV	D V	DrH   c                    t          | j                            d                    }|                     dd|          \  }}}|                     |||           |                     |dd           |                     d|z  |           | j        D ]_}|                     dd|d	         |          \  }}}|                     |||d
           |                     d|d	         d|d|           `|                     dd|          \  }}}|                     |           |                     dt          | j                  z  |           | j        D ]{}d| j        
                                z  }|                     dd|d	         |          \  }}}|                     |||d
           |                     d|d	         d|d|           ||                     dd|          \  }}}|                     |||d|z             d S )NzOU=movetestourr   r)   z$There shouldn't be any error messagezAdded ou "%s"rB   mover   zError running movezMoved user "z" into ""rJ   zFsubtree_delete: Unable to delete a non-leaf node (it has %d children)!zCN=Users,%szFailed to delete ou '%s')r   r3   r   rM   r=   r>   r?   r8   rd   r   r|   )r@   
full_ou_dnrC   rD   rE   rB   new_dns          rG   	test_movezUserCmdTestCase.test_move  sh   ::=IIJJ
!^^D%DDcfc3///b"HIIIo
2C888J 	; 	;D!%Vj": ":VS#!!&#s4HIIIMMM<<<569; ; ; ; "^^D(JGGc6""" /25dj//BCF	H 	H 	H J 	7 	7D"TZ%9%9%;%;;F!%Vf"6 "6VS#!!&#s4HIIIMMM<<<1257 7 7 7 "^^D(JGGcfc38:E	G 	G 	G 	G 	GrH   c           
         | j         D ]g}d|d         z   }d}d|d         z   }|                     |d                   }t          |                    d                    }|                     dd|d         d|z  d	|z  d
|z            \  }}}	|                     |||	           |                     |	dd           |                     d|           |                     |d                   }|                     d|                    d          z  |           |                     d|                    d          z  |           |                     d|                    d          z  |           |                     d|                    d          z  |d|d|           |                     d|                    d          z  |d|d|           |                     dd|d         ddd          \  }}}	|                     |||	           |                     |	dd           |                     d|           |                     |d                   }|                     |                    d          d           |                     |                    d          d           |                     |                    d          d           |                     d|                    d          z  |d                    |                     dd|d         d|z  d|z            \  }}}	|                     |||	           |r%|                     dd|d         d|z            \  }}}	idS )zlrename the existing surname and given name and add missing
        initials, then remove them, for all usersnew_given_name_of_r   Anew_surname_of_rb   rB   renamerV   --initials=%srX   r)   r*   successfullyra   	givenNameinitialssnr  . 
--surname=--initials=--given-name=N--surname=%(surname)s--given-name=%(given-name)s--force-new-cn=%s)r8   rL   r   r5   rM   r=   r>   r?   )
r@   rB   new_givennamenew_initialsnew_surnamerf   old_cnrC   rD   rE   s
             rG   &test_rename_surname_initials_givennamez6UserCmdTestCase.test_rename_surname_initials_givenname  s    J 0	N 0	ND04<?ML+d6l:KOODL11E4))F "&$v,0>0L0?,0N0AM0Q"S "SVS# !!&#s333S"&GHHHMM.#...OODL11ETEIIk$:$::MJJJTEIIj$9$99<HHHTEIIdOO3[AAATEIIf$5$55,9MM<<<UW W WTEIIdOO3,9MM<<<UW W W "&$v,0<0=0?"A "AVS# !!&#s333S"&GHHHMM.#...OODL11EUYY{33T:::UYYz22D999UYYt__d333TEIIdOO3T&\BBB "&$v,0G$0N0MPT0T"V "VVS# !!&#s333 N%)^^FHd6l0Cf0L&N &N"c_0	N 0	NrH   c           	         | j         D ]i}d|d         z   }d|d         z   }d|d         z   }|                     dd|d         d|z  d|z            \  }}}|                     |||           |                     |d	d
           |                     d|           |                     |          }|                     d|                    d          z  |           |                     d|                    d          z  |           |                     dd|d|z            \  }}}|                     |||           |                     |          }|                     d|                    d          z  |           |                     dd|d          \  }}}|                     |           |                     d|           |                     d|           |                     dd|d          \  }}}|                     |           |                     d|           |                     d|           |                     dd|d|z  d|z            \  }}}|                     |||           kdS )z?rename and try to remove the cn and the samaccount of all users
new_cn_of_r   new_samaccount_of_r?  rB   r@  z--samaccountname=%srL  r)   r*   rB  ra   rb   sAMAccountNamerV   z--force-new-cn=zFailed to rename userzdelete protected attributez--samaccountname=z--samaccountname=%(name)sz--force-new-cn=%(name)sN)r8   rM   r=   r>   r?   rL   r5   rd   )	r@   rB   new_cnnew_samaccountnamerO  rC   rD   rE   rf   s	            rG   test_rename_cn_samaccountnamez-UserCmdTestCase.test_rename_cn_samaccountname  s   J 0	4 0	4D!DL0F!5V!D+d6l:K "&$v,0E3E1F0Cf0L"N "NVS# !!&#s333S"&GHHHMM.#...OO$677ETEIIdOO3V<<<TEII.>$?$??/1 1 1 "&BT0>0L"N "NVS#!!&#s333OO$677ETEIIdOO3V<<< "&0B0A"C "CVS# v&&&MM13777MM6<<< "&0B0C"E "EVS# v&&&MM13777MM6<<< "&BT0K48190ID0P"R "RVS# !!&#s3333a0	4 0	4rH   c                 6   | j         D ]}d|d         z   }d|d         z   }d}d|d         z   }|                     dd|d         d|z            \  }}}|                     |||           |                     dd|d         d	d
d          \  }}}|                     |||           |                     dd|d         d          \  }}}|                     |||           |                     |dd           |                     d|           |                     |d                   }	|                     d|	                    d          z  |d                    |                     dd|d         d|z  d|z  d|z  d|z            \  }}}|                     |||           |                     dd|d         d          \  }}}|                     |||           |                     |dd           |                     d|           |                     |d                   }	|                     d|	                    d          z  |d|d|           |                     dd|d         dd
d|z  d|z            \  }}}|                     |||           dS )z)reset the cn of all users to the standardrS  r   r=  r>  r?  rB   r@  rL  rG  rH  rI  z
--reset-cnr)   r*   rB  ra   rb   rV   rA  rX   r  rF  rJ  rK  Nr8   rM   r=   r>   r?   rL   r5   )
r@   rB   rV  rM  rN  rO  rC   rD   rE   rf   s
             rG   test_rename_standard_cnz'UserCmdTestCase.test_rename_standard_cnJ  s   J 7	4 7	4D!DL0F04<?ML+d6l:K "&$v,0Cf0L"N "NVS#!!&#s333 "&$v,0<0=0?"A "AVS# !!&#s333 "&$v,0<"> ">VS# !!&#s333S"&GHHHMM.#...OODL11ETEIIdOO3T&\BBB "&$v,0Cf0L0>0L0?,0N0AM0Q	"S "SVS#
 !!&#s333 "&$v,0<"> ">VS# !!&#s333S"&GHHHMM.#...OODL11ETEIIdOO3,9MM<<<UW W W "&$v,0<0=0G$0N0MPT0T	"V "VVS#
 !!&#s3333o7	4 7	4rH   c           	         | j         D ]}d|d         z   }d|d         z   }|                     dd|d         d|z  d|z            \  }}}|                     |||           |                     |dd	           |                     d
|           |                     |d                   }|                     d|                    d          z  |           |                     d|                    d          z  |           |                     dd|d         dd          \  }}}|                     |||           |                     |dd	           |                     d
|           |                     |d                   }|                     |                    d          d            |                     |                    d          d            d S )Nnew_mailaddress_of_r   znew displayname of rB   r@  z--mail-address=%sz--display-name=%sr)   r*   rB  ra   maildisplayNamez--mail-address=z--display-name=rZ  )r@   rB   new_mailnew_displaynamerC   rD   rE   rf   s           rG   #test_rename_mailaddress_displaynamez3UserCmdTestCase.test_rename_mailaddress_displayname  s   J 	= 	=D,tF|;H3d6lBO "&$v,0C4<1=0C4C1D"E "EVS#
 !!&#s333S"&GHHHMM.#...OODL11ETEIIf$5$55x@@@TEIIm$<$<<oNNN "&$v,0A0A"C "CVS# !!&#s333S"&GHHHMM.#...OODL11EUYYv..555UYY}55t<<<<9	= 	=rH   c                    | j         D ]}|                     |d                   }d|                    d          z  }|                    d          d         }d|d         d|}d|d         z   }|                     dd	|d         d
|z            \  }}}	|                     |           |                     d|	           |                     dd	|d         d
|z            \  }}}	|                     |||	           |                     |	dd           |                     d|           |                     |d                   }|                     d|                    d          z  |           |                     dd	|d         d
          \  }}}	|                     |           |                     d|	           |                     dd	|d         d
|z            \  }}}	|                     |||	           dS )zrename upn of all usersr   ra   userPrincipalName@r   new_z%s@invalid.suffixrB   r@  z--upn=%szis not a valid upnr)   r*   rB  N)	r8   rL   r5   splitrM   rd   r?   r=   r>   )
r@   rB   rf   old_upnvalid_suffixvalid_new_upninvalid_new_upnrC   rD   rE   s
             rG   test_rename_upnzUserCmdTestCase.test_rename_upn  s8   J #	4 #	4DOODL11EUYY':;;;G"==--a0LL+/<<<FM1DL@O "&$v,0:4C1D"E "EVS# v&&&MM.444 "&$v,0:4A1B"C "CVS# !!&#s333S"&GHHHMM.#...OODL11ETEII.A$B$BBMRRR "&$v,0:"< "<VS#v&&&MM.444 "&$v,0:W0D"F "FVS#!!&#s3333G#	4 #	4rH   c                    	 dd l }n&# t          $ r |                     d           Y d S w xY wt          j                    }	 |                    |          }n&# t          $ r |                     d           Y d S w xY w|d         }|t          |          dk    rd}|                     |d         |d         |d         |d         ||d         d	          }| 	                    d
d|d         |d         d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  dddt          j
        d         z  d t          j
        d!         d"t          j
        d#                   \  }}}|                     |||           |                     |d$d%           |                     d&|d         z  |           |                     |           | 	                    d
d'|d                    |                     d|d         i          }| 	                    d
d|d         |d         d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  dd|d         z  d(|d)         z  d*|d+         z  d,|d-         z  d.|d/         z  ddt          j
        d         z  d t          j
        d!         d"t          j
        d#                   \  }}}|                     |||           |                     |d$d%           |                     d&|d         z  |           |                     |           | 	                    d
d'|d                    d S )0Nr   z1Skipping getpwent test, no 'pwd' module availablez5Skipping getpwent test, current EUID not found in NSS   z	Foo GECOS   r   r   )r   uid	uidNumber	gidNumbergecos
loginShellrB   rT   r   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   r   
--gecos=%srs  z--rfc2307-from-nssr   r   r   r   r   r   r   r)   r*   r,   rJ   --login-shell=%srt  --uid=%srp  --uid-number=%srq  --gid-number=%srr  )pwdImportErrorskipTestr1   geteuidgetpwuidKeyErrorr   r;   rM   r2   r=   r>   r?   _check_posix_user)	r@   rz  rp  urs  rB   rC   rD   rE   s	            rG   test_getpwentzUserCmdTestCase.test_getpwent  s   	JJJJ 	 	 	MMMNNNFF	
 jll	S!!AA 	 	 	MMQRRRFF	 !MSZZ1__E$$ !! t%&qT%&qT!&&'d& &   "^^FHd6lDQ[L\,:T)_,L,=\@R,R,<tK?P,P,=\@R,R,>mAT,T,:T)_,L,84=,H,@,0+
;@W2W2W:<*]:S:S:SUWU_`mUnUn,o
q 
qc 	fc3///b"CDDD4tF|CSIIIt$$$vxf666
 $$fad^44 "^^FHd6lDQ[L\,:T)_,L,=\@R,R,<tK?P,P,=\@R,R,>mAT,T,:T)_,L,@,84=,H,>lAS,S,6e,D,=[@Q,Q,=[@Q,Q,0+
;@W2W2W:<*]:S:S:SUWU_`mUnUn,oq qc  	fc3///b"CDDD4tF|CSIIIt$$$vxf66666s    **A A:9A:c                 :   d}|                      dd|          \  }}}|                     |d           |                     d|z  |           |                     d|           d}d}|                      dd	|d
           |                      dd	|d
           |                      dd|ddt          j        d         z  d|dd
          \  }}}|                     |d           |                     d|z  |           |                     d|           |                      dd|           |                      dd|           | j        D ]R}|                      dd|d                   \  }}}|                     |||d           |                     |dd           Sd S )NuserdoesnotexistrB   unlockz)Ensure that unlock nonexistent user failszFailed to unlock user '%s'rj   unprivilegedunlockuserusertounlockrr   Passw0rdr   r   r   r   r   z)Fail with LDAP_INSUFFICIENT_ACCESS_RIGHTSz-LDAP error 50 LDAP_INSUFFICIENT_ACCESS_RIGHTSrJ   r   zError running user unlockr)   r*   )rM   rd   r?   r1   r2   r8   r=   r>   )r@   nonexistentusernamerC   rD   rE   unprivileged_usernameunlocktest_usernamerB   s           rG   test_unlockzUserCmdTestCase.test_unlock   s    1!^^H13 3c6#NOOO25HH#NNN+S111 !9,vu&;ZHHHvu&9:FFF!^^H1+
; 777///$*&' 'c
 	6#NOOO25HH#NNNEsKKKvx)>???vx)<=== J 	I 	ID!%$v,"0 "0VS#!!&#s4OPPPS"&GHHHH		I 	IrH   c                    |                                  |                     d          |                                  |                                  |                                  |                                  |                                  |                      d          | j        | j        d
}|                    |           |S )zKcreate a user with random attribute values, you can specify base attributesr   d   )count)
r   rU   rW   rY   r[   r]   r   r_   r(   r-   )rx   r   rc   _check_userupdate)r@   r   rB   s      rG   r:   zUserCmdTestCase._randomUserD  s     OO%%,,R00((//++**//++((???55 -+
 
 	DrH   c                    |                      i           }|                    |           |                                 |                                 |                                 |                                 |                                 | j        | j        d}|                    |           |                    |           |S )ucreate a user with random attribute values and additional RFC2307
        attributes, you can specify base attributes)rp  rt  rs  rq  rr  r(   r-   )r:   r  rx   	randomXid_create_posix_userr  r@   r   rB   posixAttributess       rG   r;   z UserCmdTestCase._randomPosixUserU  s     ##D??$$//++__&&)))) 31
 
 	O$$$DrH   c                    |                      i           }|                    |           |                                 |                                 |                                 |                                 |                                 | j        | j        d}|                    |           |                    |           |S )r  )rq  rr  rp  rt  rs  r(   r-   )r:   r  r  rx   _create_unix_user_check_unix_userr  s       rG   r<   zUserCmdTestCase._randomUnixUserg  s     ##D))))??$$//++__&& 20
 
 	O$$$DrH   c                 *   |                      |d                   }|                     d|                    d          z  d|z             |                     d|                    d          z  |d                    |                     d|                    d          z  |d                    |                     d|                    d          z  |d                    |                     d|                    d          z  |d                    d	S )
zD check if a user from SamDB has the same attributes as its template r   ra   z%(given-name)s %(surname)stitler[   r   r_   r]   N)rL   r>   r5   r@   rB   rf   s      rG   r  zUserCmdTestCase._check_usery  s    V--		& 1 113ORV3VWWW		' 2 22D4EFFF		) 4 44d9oFFF		- 8 88$}:MNNN		, 7 77l9KLLLLLrH   c                 f   |                      |d                   }|                     d|                    d          z  |d                    |                     d|                    d          z  |d                    |                     d|                    d          z  d|d         z             |                     d|                    d          z  d|d         z             |                     d|                    d          z  |d                    |                     |           dS )	zJ check if a posix_user from SamDB has the same attributes as its template r   ra   rt  rs  rq  rr  rp  N)rL   r>   r5   r  r  s      rG   r  z!UserCmdTestCase._check_posix_user  s   V--		, 7 77l9KLLL		' 2 22DMBBB		+ 6 66tK?P8PQQQ		+ 6 66tK?P8PQQQ		% 0 00$u+>>>rH   c                    |                      |d                   }|                     d|                    d          z  |d                    |                     d|                    d          z  |d                    |                     d|                    d          z  d|d         z             |                     d|                    d          z  d|d         z             |                     d|                    d          z  |d                    |                     dd|                    d	          z             |                     |           d
S )zI check if a unix_user from SamDB has the same attributes as its
template r   ra   rt  rs  rq  rr  rp  z/home/test/unixHomeDirectoryN)rL   r>   r5   r?   r  r  s      rG   r  z UserCmdTestCase._check_unix_user  sO    V--		, 7 77l9KLLL		' 2 22DMBBB		+ 6 66{+9, 	- 	- 	-		+ 6 66{+9, 	- 	- 	-		% 0 00$u+>>>mTEII6I,J,J%JKKKrH   c                 :   |                      dd|d         |d         d|d         z  d|d         z  d	|d
         z  d|d         z  d|d         z  d|d         z  ddt          j        d         z  dt          j        d         dt          j        d                   S )NrB   rr   r   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   r   r   r   r   r   r   r   r   rM   r1   r2   r@   rB   s     rG   rc   zUserCmdTestCase._create_user  s    ~~feT&\4
;K,tI>/$|2DD.k1BB/$|2DD043FF,tI>"K"*[2I$I$I,.J},E,E,ErzR_G`G`ac c 	crH   c                    |                      dd|d         |d         d|d         z  d|d         z  d	|d
         z  d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  d|d         z  ddt          j        d         z  dt          j        d         d t          j        d!                   S )"z+ create a new user with RFC2307 attributes rB   rT   r   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   r   ru  rs  rv  rt  rw  rp  rx  rq  ry  rr  r   r   r   r   r   r   r   r  r  s     rG   r  z"UserCmdTestCase._create_posix_user  s    ~~fhVd:>N,tI>/$|2DD.k1BB/$|2DD043FF,tI>*T']:043EE(4;6/${2CC/${2CC"K"*[2I$I$I,.J},E,E,ErzR_G`G`ac c 	crH   c                 B   |                      |           |                     dd|d         d|d         z  d|d         z  d|d	         z  d
|d         z  d|d         z  ddt          j        d         z  dt          j        d         dt          j        d                   S )z! Add RFC2307 attributes to a userrB   addunixattrsr   ra   rq  ry  rr  ru  rs  rv  rt  rw  rp  r   r   r   r   r   r   r   )rc   rM   r1   r2   r  s     rG   r  z!UserCmdTestCase._create_unix_user  s    $~~fnd6l"T+%66/${2CC*T']:043EE(4;6"K"*[2I$I$I,.J},E,E,E,.J},E,EGH H 	HrH   c                     dt          j        |          ddd| j                                        d}| j                            | j                                        t           j        |          }|r|d         S d S )Nz(&(sAMAccountName=z)(objectCategory=z$CN=Person,CN=Schema,CN=Configurationr   z)))r   rw   rv   r   )r}   binary_encoder3   r|   r{   r~   )r@   r   r   r   s       rG   rL   zUserCmdTestCase._find_user  s     JMJ[\`JaJaJaJa  dJ  dJ  dJ  LP  LV  L`  L`  Lb  Lb  Lb  Lb  c:$$$**>*>*@*@+.+<0= % ? ?  	A;4rH   )r   r   )&__name__
__module____qualname____doc__r8   r3   r/   rK   rg   r   r   r   r   r   r   r  r  r  r4  r;  rQ  rX  r[  rb  rl  r  r  r:   r;   r<   r  r  r  rc   r  r  rL   __classcell__)rF   s   @rG   r   r   $   s       //EE%& %& %& %& %&N: : : : :"J "J "JH$G $G $GN 6756QN QN QN QNfz[ z[ z[x$z $z $zLC C C.C C C.C C C,#/ #/ #/J0 0 0BWD WD WDrG G G@3N 3N 3Nj24 24 24h94 94 94v= = =>%4 %4 %4NN7 N7 N7j"I "I "IH  "    " %'    $ $&    $M M M	 	 	  	c 	c 	cc c c"H H H      rH   r   )r1   r   r   r}   samba.tests.samba_tool.baser   sambar   r   r   r   	samba.ndrr   samba.dcerpcr	   samba.commonr
   r   samba.testsr   r    rH   rG   <module>r     s  $ 
			   



 8 8 8 8 8 8
 
 
 
 
 
 
 
 
 
 
 
 !           ! ! ! ! ! ! " " " " " " # # # # # # $ $ $ $ $ $j j j j j& j j j j jrH   