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__/dsacl.cpython-310.pyc
o

�/au�@s8ddlZddlZddlmZddlZGdd�de�ZdS)�N)�SambaToolCmdTestcs�eZdZdZdZdZdZdZdZ�fdd�Z	�fdd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Z�ZS)�DSaclSetSddlTestCasez0Tests for samba-tool dsacl set --sddl subcommandz[(OA;CIIO;RPWP;aaaaaaaa-1111-bbbb-2222-dddddddddddd;33333333-eeee-4444-ffff-555555555555;PS)z[(OA;CIIO;RPWP;AAAAAAAA-1111-BBBB-2222-DDDDDDDDDDDD;33333333-EEEE-4444-FFFF-555555555555;PS)za(OA;CIIO;RPWP;aaaaaaaa-1111-bbbb-2222-dddddddddddd;33333333-eeee-4444-ffff-555555555555;S-1-5-10)z�(OA;CIIO;RPWP;aaaaaaaa-1111-bbbb-2222-dddddddddddd;33333333-eeee-4444-ffff-555555555555;PS)(OA;CIIO;RPWP;cccccccc-9999-ffff-8888-eeeeeeeeeeee;77777777-dddd-6666-bbbb-555555555555;PS)cs^tt|���|�ddtjddtjdtjdf�|_d|j��|_|j�	|j�dS)Nz-Hz	ldap://%s�	DC_SERVERz-U%s%%%s�DC_USERNAME�DC_PASSWORDzOU=DSaclSetSddlTestCase,%s)
�superr�setUp�getSamDB�os�environ�samdb�	domain_dn�dn�	create_ou��self��	__class__��>/usr/lib/python3/dist-packages/samba/tests/samba_tool/dsacl.pyrs.zDSaclSetSddlTestCase.setUpcs tt|���|j�|j�dS)N)rr�tearDownr�deleterrrrrr%szDSaclSetSddlTestCase.tearDowncCsx|�ddd|jd|j�\}}}|�|||�|�|dd�t�d|�}|�|d|d	d
�|�|d	|jd�dS)
z4Tests if a sddl string can be added 'the normal way'�dsacl�set�
--objectdn=%s�	--sddl=%s��Shouldn't be any error messages�.*descriptor for.*:
(.*?)
r�znew and old SDDL string differ�=new SDDL string should be contained within second sddl outputN)	�	runsubcmdr�sddl�assertCmdSuccess�assertEqual�re�findall�assertNotEqual�assertMatch)r�result�out�err�acl_listrrr�	test_sddl*s"zDSaclSetSddlTestCase.test_sddlcCs�|�ddd|j�\}}}|�|||�|�|dd�t�d|�}|�ddd|jd|j�\}}}|�|||�|�|dd�t�d	|�}|�||d
�t�d|�}|�ddd|j�\}}}|�|||�|�|dd�t�d|�}|�||d�d
S)zXTests if a sddl string can be added 'the normal way' and the output of 'get' is the samer�getrrrz^descriptor for.*:
(.*?)
rrzold descriptor for.*:
(.*?)
z4output of dsacl get should be the same as before setznew descriptor for.*:
(.*?)
z3output of dsacl get should be the same as after setN)r!rr#r$r%r&r")rr)r*r+�acl_list_get�acl_list_oldr,�
acl_list_get2rrr�test_sddl_set_get4s4
�
��
��z&DSaclSetSddlTestCase.test_sddl_set_getcCst|�ddd|jd|j�\}}}|�|||�|�|dd�t�d|�}t�d|j�D]}|�|d	|d
�q,dS)zETests if we can add multiple, different sddl strings at the same timerrrrrrrz\(.*?\)rr N)r!r�
sddl_multir#r$r%r&r()rr)r*r+r,�acerrr�test_multisddlRs"�z#DSaclSetSddlTestCase.test_multisddlcCs(|�|j|j�}|�|d|d�dS)zMTests if an already existing sddl string can be added causing duplicate entryrrN��_double_sddl_checkr"r$�rr,rrr�test_duplicatesddl\�z'DSaclSetSddlTestCase.test_duplicatesddlcC�(|�|j|j�}|�|d|d�dS)z`Tests if an already existing sddl string can be added in different cases causing duplicate entryrrN)r7�sddl_lc�sddl_ucr$r8rrr�test_casesensitivesddlar:z+DSaclSetSddlTestCase.test_casesensitivesddlcCr;)zpTests if an already existing sddl string can be added with SID instead of SDDL SIDString causing duplicate entryrrN)r7r"�sddl_sidr$r8rrr�test_sidsddlfr:z!DSaclSetSddlTestCase.test_sidsddlcCs.|�|j|j|j�}|�|d|d�dS)z�Tests if an already existing sddl string can be added by using it twice/in combination with non existing sddl string causing duplicate entryrrNr6r8rrr�test_twosddlksz!DSaclSetSddlTestCase.test_twosddlcCs�|�ddd|jd|�\}}}|�|||�|�|dd�t�d|�}|�|d|d	�|�ddd|jd|�\}}}|�|||�|�|dd�t�d|�}|S)
zSAdds two sddl strings and checks if there was an ace change after the second addingrrrrrrrrzFnew SDDL string should be contained within second sddl output - is not)r!rr#r$r%r&r()r�sddl1�sddl2r)r*r+r,rrrr7ps  z'DSaclSetSddlTestCase._double_sddl_check)�__name__�
__module__�__qualname__�__doc__r"r<r=r?r3rrr-r2r5r9r>r@rAr7�
__classcell__rrrrrs"

r)r
�ldb�samba.tests.samba_tool.baserr%rrrrr�<module>s