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: //usr/lib/python3/dist-packages/samba/tests/__pycache__/encrypted_secrets.cpython-310.pyc
o

�/a�@sxdZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZGd	d
�d
e�ZdS)zySmoke test for encrypted secrets

A quick test to confirm that the secret attributes are being stored
encrypted on disk.
�N)�TestCase)�Credentials)�SamDB)�system_session)�
ndr_unpack)�drsblobscs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�EncryptedSecretsTestscsZtt|���tj��|_t�|_t	�|_
|j�|j�t	�|_
t|j
|j|jd�|_
dS)N)�session_info�credentials�lp)�superr�setUp�samba�tests�env_loadparmrr�credsr�session�guessr�ldb)�self��	__class__��?/usr/lib/python3/dist-packages/samba/tests/encrypted_secrets.pyr
's�zEncryptedSecretsTests.setUpcCs�|j��}d|��}tj�d|�}|j�|�}tjd|tj	d�}d|}|j
tj|dgd�}|�dt
|�d	k�|d	}|dd	}	|�t
|	�d
k�ttj|	�}
d}|�||
jj�dS)
z8Test that secret attributes are stored encrypted on diskz%s.ldbz	sam.ldb.dzldb://)�flagszCN=Administrator,CN=Users,%s�
unicodePwd��scope�base�attrsTr�l�-�N)r�	domain_dn�upper�os�path�joinr�private_path�Ldb�FLG_DONT_CREATE_DB�search�
SCOPE_BASE�assertIs�len�
assertTruerr�EncryptedSecret�assertEqual�header�magic)r�basedn�backend_filename�backend_subpath�backend_path�	backenddb�dn�res�obj�blob�	encryptedr1rrr�test_encrypted_secrets2s&
��z,EncryptedSecretsTests.test_encrypted_secretscCsX|jjtjddgd�}|�t|�dk�|�d|dv�|dd}|�d|v�dS)zcTest that databases are provisioned with encryptedSecrets as a
           required feature
        z@SAMBA_DSDB�requiredFeaturesrrsencryptedSecretsN)rr)r*r-r,)rr8�required_featuresrrr�test_required_featuresIs
�z,EncryptedSecretsTests.test_required_features)�__name__�
__module__�__qualname__r
r<r?�
__classcell__rrrrr%sr)�__doc__r#rr�samba.testsr�samba.credentialsr�samba.samdbr�
samba.authr�	samba.ndrr�samba.dcerpcrrrrrr�<module>s