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/dcerpc/__pycache__/testrpc.cpython-310.pyc
o

�/a��@s�ddlZej�dd�ddlZddlZddlmZddlZe��Gdd�de	�Z
e
�Ze��Z
e
dkr;e�d�dSede
�e�d�dS)�Nz
bin/python)�drsuapic@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�RpcTestsz5test type behaviour of pidl generated python RPC codecCs@t�|�}|dur||j8}||}|dkrtd|�dSdS)z4check that the number of allocated blocks is correctNrzLeaked %d blocks)�talloc�total_blocks�initial_blocks�print)�self�object�num_expected�nblocks�
leaked_blocks�r
�</usr/lib/python3/dist-packages/samba/tests/dcerpc/testrpc.py�check_blocks s

�zRpcTests.check_blocksc	Cs6td|�|�}t|�D�]
}|ddkrq
zt||�}Wn|ty�}zYt|�dkrAtd||f�|jd7_WYd}~q
tt|�dd��t|�dd�dkrjtd	||f�|jd7_WYd}~q
td
||f�|jd7_WYd}~q
d}~wty�td
||f�|jd7_Yq
wztd||f�t|||�Wn6ty�}z*t|t	�r�t|��
d�r�WYd}~q
td
|||j|f�|jd7_WYd}~q
d}~wwz|t||�kr�td|||t||�f�Wq
Wq
t�y}ztd|||j|f�WYd}~q
d}~wwdS)NzChecking type %sr�_zunknown union levelz#ERROR: Unknown union level in %s.%s��zCan not convert C TypezERROR: Unknown C type for %s.%sz"ERROR: Failed to instantiate %s.%sz
Setting %s.%szis read-onlyz"ERROR: Failed to set %s.%s: %r: %sz,ERROR: Comparison failed for %s.%s: %r != %rz*ERROR: compare exception for %s.%s: %r: %s)r�dir�getattr�	TypeError�str�errcount�	Exception�setattr�
isinstance�AttributeError�endswith�	__class__)	r�	interface�typename�type�v�n�value�errstr�er
r
r�
check_type)s`����
����zRpcTests.check_typecCs|j}t|�D]i}|ddks||krqt||�}t|t�rqt|t�r%qt|t�rczt�d�}|�	|||�|�
d|�Wqtyb}ztd|||j
|f�|jd7_WYd}~qd}~wwt|�rhqtd||f�q|j|dkr�td|j||f�dSdS)Nrrz)ERROR: Failed to check_type %s.%s: %r: %srzUNKNOWN: %s=%szFound %d errors in %s)rrrrr�intr rrr&rrrr�callable)rr�inamerr"r#rr%r
r
r�check_interfaceZs2




���zRpcTests.check_interfacecCsnttj�D]/}|ddkrq|dks|dkrqtd|�ttj|�}t�d�}|�||�|�d|�qdS)Nrr�ClientConnection�basezChecking interface %s)	r�samba�dcerpcrrrrr*r)rr)�ifacerr
r
r�check_all_interfacesvs
�zRpcTests.check_all_interfacescCs t�d�|_d|_|��|jS)Nr)rrrrr0)rr
r
r�run�szRpcTests.runN)	�__name__�
__module__�__qualname__�__doc__rr&r*r0r1r
r
r
rrs	1rz%d failuresr)�sys�path�insertr-�samba.tests�samba.dcerpcrr�enable_null_trackingr	r�testsr1r�exitrr
r
r
r�<module>sl