HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/samba/tests/samba_tool/__pycache__/rodc.cpython-310.pyc
o

�/a��@shddlZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZGdd�de�Z
dS)	�N)�SamDB)�delete_force)�SambaToolCmdTest)�Credentials)�system_sessioncspeZdZ�fdd�Z�fdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
�ZS)�RodcCmdTestCasecs
tt|���tj��|_|j�tj	d�t
�|_|j�tj	d�|j�
tj	d�|j�|j�t�|_tdtj	d|j|j|jd�|_|j��|_|j�dd�|j�d	d
�|j�dd�|j�d
d�|j�dd�|j�dd�|jjdgd�dd�dS)N�
SMB_CONF_PATH�DC_USERNAME�DC_PASSWORDzldap://�	DC_SERVER)�session_info�credentials�lp�
sambatool1z1qazXSW@�
sambatool2z2wsxCDE#�
sambatool3z3edcVFR$�
sambatool4z4rfvBGT%�
sambatool5z5tjbNHY*�
sambatool6z6yknMJU*z'Allowed RODC Password Replication Group)rrrrrT)�add_members_operation)�superr�setUp�samba�param�LoadParmr�load�os�environr�creds�set_username�set_password�guessr�sessionr�ldb�	domain_dn�base_dn�newuser�add_remove_group_members)�self��	__class__��=/usr/lib/python3/dist-packages/samba/tests/samba_tool/rodc.pyrs,�
�zRodcCmdTestCase.setUpcs|tt|���|j�d�|j�d�|j�d�|j�d�|j�d�|j�d�|�ddd	d
tjd|j�\}}}dS)Nrrrrrr�drs�	replicatez--local�unusedr)	rr�tearDownr#�
deleteuser�	runsubcmdrrr%�r(�result�out�errr)r+r,r07s�zRodcCmdTestCase.tearDowncCsP|�ddddtjd�\}}}|�|||d�|�|d|j�|�|d�dS)	N�rodc�preloadr�--serverr�'ensuring rodc prefetch ran successfullyz)Replicating DN CN=sambatool1,CN=Users,%s
��r2rr�assertCmdSuccess�assertEqualr%r3r+r+r,�test_single_by_account_nameBs


�z+RodcCmdTestCase.test_single_by_account_namecCsJ|�ddd|jdtjd�\}}}|�|||d�|�|d|j�dS)Nr7r8zcn=sambatool2,cn=users,%sr9rr:z)Replicating DN CN=sambatool2,CN=Users,%s
�r2r%rrr=r>r3r+r+r,�test_single_by_dnIs


�z!RodcCmdTestCase.test_single_by_dnc	CsL|�dddddtjd�\}}}|�|||d�|�|d|j|jf�dS)	Nr7r8rrr9rr:�RReplicating DN CN=sambatool1,CN=Users,%s
Replicating DN CN=sambatool2,CN=Users,%s
r<r3r+r+r,�test_multi_by_account_nameOs


�z*RodcCmdTestCase.test_multi_by_account_namec	CsX|�ddd|jd|jdtjd�\}}}|�|||d�|�|d|j|jf�dS)	Nr7r8zcn=sambatool3,cn=users,%szcn=sambatool4,cn=users,%sr9rr:zRReplicating DN CN=sambatool3,CN=Users,%s
Replicating DN CN=sambatool4,CN=Users,%s
r@r3r+r+r,�test_multi_by_dnUs


�z RodcCmdTestCase.test_multi_by_dnc	Csvtj�|jd�}t|d��d�|�ddd|dtjd�\}}}|�|||d	�|�	|d
|j
|j
f�t�|�dS)N�accountlist�wzsambatool1
sambatool2r7r8z--filer9rr:rB)r�path�join�tempdir�open�writer2rr=r>r%�unlink)r(�tempfr4r5r6r+r+r,�test_multi_in_file[s

�z"RodcCmdTestCase.test_multi_in_filec
CsN|�ddddddtjdd�\}}}|�|||d	�|�|�d
|j��dS)Nr7r8�nonexistentuser1r�nonexistentuser2r9r�--ignore-errorsr:z)Replicating DN CN=sambatool5,CN=Users,%s
�r2rrr=�
assertTrue�
startswithr%r3r+r+r,�$test_multi_with_missing_name_successds

�
�z4RodcCmdTestCase.test_multi_with_missing_name_successc
Cs2|�ddddddtjd�\}}}|�|d�dS)	Nr7r8rOrrPr9rz+ensuring rodc prefetch quit on missing user�r2rr�
assertCmdFailr3r+r+r,�$test_multi_with_missing_name_failurens

�z4RodcCmdTestCase.test_multi_with_missing_name_failurec	CsR|�dddddtjdd�\}}}|�|||d�|�|�d	|j|jf��dS)
Nr7r8rrr9rrQr:zRReplicating DN CN=sambatool6,CN=Users,%s
Replicating DN CN=sambatool5,CN=Users,%s
rRr3r+r+r,� test_multi_without_group_successus

�

�z0RodcCmdTestCase.test_multi_without_group_successc	Cs0|�dddddtjd�\}}}|�|d�dS)Nr7r8rrr9rz2ensuring rodc prefetch quit on non-replicated userrVr3r+r+r,� test_multi_without_group_failures


�z0RodcCmdTestCase.test_multi_without_group_failure)�__name__�
__module__�__qualname__rr0r?rArCrDrNrUrXrYrZ�
__classcell__r+r+r)r,rs	

r)rr#r�samba.samdbr�samba.testsr�samba.tests.samba_tool.baser�samba.credentialsr�
samba.authrrr+r+r+r,�<module>s