HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //usr/lib64/python3.9/site-packages/setools/checker/__pycache__/descriptors.cpython-39.pyc
a

q�qe��@shddlZddlmZmZddlmZddlmZmZGdd�de�Z	Gdd	�d	e�Z
Gd
d�de�ZdS)�N)�Callable�Union�)�InvalidCheckValue)�CriteriaDescriptor�CriteriaPermissionSetDescriptorcs<eZdZdZeeefdd��fdd�Z�fdd�Z�Z	S)�ConfigDescriptoraU
    Single item configuration option descriptor.

    Parameter:
    lookup_function The name of the SELinuxPolicy lookup function,
                    e.g. lookup_type or lookup_boolean.

    Read-only instance attribute use (obj parameter):
    checkname       The name of the check.
    policy          The instance of SELinuxPolicy
    N)�lookup_function�returncst�j|d�dS)N)r	)�super�__init__)�selfr	��	__class__��A/usr/lib64/python3.9/site-packages/setools/checker/descriptors.pyrszConfigDescriptor.__init__c
sh|sd|j|<nTzt��||���Wn<tyb}z$td�|j|j|��|�WYd}~n
d}~00dS)N�{}: Invalid {} setting: {})	�	instancesr�__set__�strip�
ValueErrorr�format�	checkname�name�r
�obj�value�exrrrrs
��zConfigDescriptor.__set__)
�__name__�
__module__�__qualname__�__doc__rr�strrr�
__classcell__rrrrrsrcs>eZdZdZd
eeefeedd��fdd�
Zdd	�Z	�Z
S)�ConfigSetDescriptora
    Descriptor for a configuration option set.

    Parameter:
    lookup_function The name of the SELinuxPolicy lookup function,
                    e.g. lookup_type or lookup_boolean.

    Keyword Parameters:
    strict          (Bool) If True, all objects must exist in the policy
                    when setting the value.  If False, any objects that
                    fail the policy lookup will be dropped instead of raising
                    an exception.  The default is True.
    expand          (Bool) If True, each object will be expanded.  Default
                    is False.

    Read-only instance attribute use (obj parameter):
    checkname       The name of the check.
    log             A logger instance.
    policy          The instance of SELinuxPolicy
    TFN)r	�strict�expandr
cs"t�j|t�d�||_||_dS)N)r	�
default_value)rr�	frozensetr%r&)r
r	r%r&rrrr?szConfigSetDescriptor.__init__c	Cs|st�|j|<�n|j}t|j�r,|j}nt|j|j�}t�}dd�t�	d|�D�D]�}z,||�}|j
rz|�|�
��n
|�|�WqVt
�y}zd|jr�|�d�|j|��|jd|d�td�|j|j|��|�|�d�|j|j|��WYd}~qVd}~00qVt|�|j|<dS)Ncss|]}|r|VqdS�Nr)�.0�irrr�	<genexpr>P�z.ConfigSetDescriptor.__set__.<locals>.<genexpr>z\szInvalid {} item: {}z
Traceback:)�exc_infoz{}: Invalid {} item: {})r(r�log�callabler	�getattrZpolicy�set�re�splitr&�update�addrr%�errorrr�debugrr�info)	r
rrr/�lookup�ret�item�o�errrrFs4

��
�zConfigSetDescriptor.__set__)TF)rrr r!rrr"�boolrrr#rrrrr$(s��r$cs2eZdZdZdd��fdd�Z�fdd�Z�ZS)�ConfigPermissionSetDescriptoraJ
    Descriptor for a configuration permissions set.

    Read-only instance attribute use (obj parameter):
    checkname       The name of the check.
    policy          The instance of SELinuxPolicy
    tclass          If it exists, it will be used to validate the
                    permissions.  See validate_perms_any()
    N)r
cst�jt�d�dS)N)r')rrr()r
rrrrpsz&ConfigPermissionSetDescriptor.__init__c
sv|st�|j|<n`z"t��|dd�|�d�D��Wn<typ}z$td�|j|j	|��|�WYd}~n
d}~00dS)Ncss|]}|r|VqdSr)r)r*�vrrrr,xr-z8ConfigPermissionSetDescriptor.__set__.<locals>.<genexpr>� r)
r(rrrr4rrrrrrrrrrss"
��z%ConfigPermissionSetDescriptor.__set__)rrr r!rrr#rrrrr@ds
r@)r3�typingrr�	exceptionrZdescriptorsrrrr$r@rrrr�<module>s<