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/krb5/__pycache__/test_rpc.cpython-310.pyc
o

eF�c�@s�ddlZddlZej�dd�dejd<ddlZddlmZmZddl	m
Z
ddlmZm
Z
ddlmZd	Zd	ZGd
d�de�ZedkrRd	Zd	ZddlZe��dSdS)
�Nz
bin/python�1�PYTHONUNBUFFERED)�
NTSTATUSError�credentials)�lsa)�NT_STATUS_ACCESS_DENIED� NT_STATUS_NO_IMPERSONATION_TOKEN)�KDCBaseTestFc@s>eZdZdZdd�Zdd�Zdd�Z			dd
d�Zdd
�ZdS)�RpcTestszfTest for RPC authentication using Kerberos credentials stored in a
       credentials cache file.
    cCs|��dS)N��
_run_rpc_test��self�r�;/usr/lib/python3/dist-packages/samba/tests/krb5/test_rpc.py�test_rpc.szRpcTests.test_rpccCs|jdd�dS)NT)�renamerr
rrr�test_rpc_rename1szRpcTests.test_rpc_renamecCs|jdddd�dS)NFT)�include_pac�expect_anon�allow_errorrr
rrr�test_rpc_no_pac4s
�zRpcTests.test_rpc_no_pacFTc
Cs:|��}|j}d}|j|jjdd�}|��}	|��}
|j||
|||d�\}}|�t	j
|j�|rJ|��}
t
�|���}t
�|
t
jd�|d<|�|�d|}zt�||��|�}Wn&ty}z|sg|��|j\}}|�|tth�WYd}~dSd}~ww|�ddd�\}}|r�|�|	|j�dS|�|	|j�dS)N�cifsF)�account_type�	use_cache)�pac�sAMAccountName�ncacn_np:%s[\pipe\lsarpc]) �	get_samdb�host�get_cached_creds�AccountType�USER�get_username�get_server_creds�create_ccache_with_user�
addCleanup�os�remove�name�get_new_username�ldb�Message�get_dn�MessageElement�FLAG_MOD_REPLACE�modifyr�lsarpc�get_lpr�fail�args�assertInrr�GetUserName�assertNotEqual�string�assertEqual)rrrrr�samdb�	mach_name�service�user_credentials�	user_name�mach_credentials�creds�	cachefile�new_name�msg�binding_str�conn�e�enum�_�account_namerrrr8sR�
��

���	zRpcTests._run_rpc_testcCsX|j}t��}|��d|}t�||��|�}|�ddd�\}}|�d|j	�
��dS)NrzANONYMOUS LOGON)rr�Credentials�
set_anonymousrr1r2r6r9r8�upper)rr;�
anon_credsrDrErIrHrrr�test_rpc_anonymousxszRpcTests.test_rpc_anonymousN)FTFF)	�__name__�
__module__�__qualname__�__doc__rrrrrNrrrrr
)s
�@r
�__main__)�sysr'�path�insert�environr+�sambarr�samba.dcerpcr�samba.ntstatusrr�samba.tests.krb5.kdc_base_testr	�global_asn1_print�global_hexdumpr
rO�unittest�mainrrrr�<module>s$
]�