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/blackbox/__pycache__/samba_dnsupdate.cpython-310.pyc
o

�/a��@sxddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlZddlZGdd	�d	ejj�ZdS)
�N)�StringIO)�
get_string)�
cmd_sambatool)�Credentials)�system_session)�SamDBcs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�SambaDnsUpdateTestsz'Blackbox test case for samba_dnsupdate.csVtj�d�|_tt|���z|�d�}|�d|v|�WdStjj	y*YdSw)N�
DNS_SERVER_IP�samba_dnsupdate --verbosesLooking for DNS entry)
�samba�tests�env_get_var_value�	server_ip�superr�setUp�check_output�
assertTrue�BlackboxProcessError)�self�out��	__class__��F/usr/lib/python3/dist-packages/samba/tests/blackbox/samba_dnsupdate.pyr!s
�zSambaDnsUpdateTests.setUpc
CsZz|�d�}Wntjjy"}z
|�d|�WYd}~nd}~ww|�d|v|�dS)Nr
�!Error calling samba_dnsupdate: %s�No DNS updates needed)rrrr�failr)rr�errr�test_samba_dnsupate_no_change*s��z1SambaDnsUpdateTests.test_samba_dnsupate_no_changec
Cs*z|�d�}|�d|v|�|�d|v|�Wntjjy"Ynwz|�d�}WntjjyE}z
|�d|�WYd}~nd}~ww|�d|v|�z
|�d|j�}Wntjjys}z
|�d|�WYd}~nd}~ww|�d|v|�|�d|v|�|�d�}|�d|v||�dS)	Nz/samba_dnsupdate --verbose --current-ip=10.0.0.1s DNS updates ands DNS deletes neededz>samba_dnsupdate --verbose --use-nsupdate --current-ip=10.0.0.1rrz=samba_dnsupdate --verbose --use-samba-tool --rpc-server-ip=%sr
)rrrrrrr)rrr�rpc_outrrr�test_samba_dnsupate_set_ip1s0
�����
z.SambaDnsUpdateTests.test_samba_dnsupate_set_ipc
Cs�d}tj|}t�|_t�|_d}|�d|d|�|�d|d|�}|dur,|�d�tj�	�|_
t�|_|j�
|j
�t�|_|j
�d�}|d}t�||�t|j|j|j
d	�|_t��}t�|jd
�|j����|_t�d�||j���tjd�|d<d
�|�}t|�|��}	|�|� �|	�|j�!|�t�||�t|�|��}	|�d|	�|�"|� �|	�|�d|d|�}|dur�|�d�dSdS)N�sites�ABCDEFGHIJKLMNOPQRSTUVWXYZz
samba-tool %s�remove�createzError creating new site�dns_update_cache�_tmp)�session_info�credentials�lpz@CN=DEFAULTIPSITELINK,CN=IP,CN=Inter-Site Transports,CN=Sites,{0}zCN={0},CN=Sites,{1}�siteListz(samba_dnsupdate --verbose --use-file={0}zNo DNS updates neededzError deleting site)#r�subcommandsr�outf�errf�_runrrr�env_loadparmr)r�creds�guessr�session�private_path�shutil�copyfiler�samdb�ldb�Message�Dn�format�get_config_basedn�dn�MessageElement�FLAG_MOD_ADDrr�assertNotIn�lower�modify�assertIn)
r�name�cmd�	site_name�result�uc_fn�tmp_uc�m�dns_crrrr�test_add_new_uncovered_siteIsX

�
����
�z/SambaDnsUpdateTests.test_add_new_uncovered_site)	�__name__�
__module__�__qualname__�__doc__rrr rK�
__classcell__rrrrrs	r)�samba.testsr�ior�samba.commonr�samba.netcmd.mainr�samba.credentialsr�
samba.authr�samba.samdbrr7r4r�BlackboxTestCaserrrrr�<module>s