HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ns3133907 6.8.0-86-generic #87-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 18:03:36 UTC 2025 x86_64
User: cssnetorguk (1024)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //proc/self/root/usr/libexec/kcare/python/kcarectl/__pycache__/selinux.cpython-312.pyc
�

p��g���x�ddlZddlmZddlmZddlmZddlmZd�Zd�Zd	�Zd
�Z	ejd��Zy)�N�)�
process_utils)�	log_utils)�errors)�utilsc��tjj|�\}}tjj|d|z�S)Nztmp.)�os�path�split�join)�fname�head�tails   �-/usr/libexec/kcare/python/kcarectl/selinux.py�selinux_safe_tmpnamer
s1�������u�%�J�D�$�
�7�7�<�<��f�t�m�,�,�c���t�ratjdd�d|g}tj|dd��\}}}|r)t	j
dj
|||�d��yyy)	N�
restorecon)z	/usr/sbinz/sbinz-RT)�catch_stdout�catch_stderrz8SELinux context restoration for {0} failed with {1}: {2}F)�	print_msg)�is_selinux_enabledr�find_cmd�run_commandr�logerror�format)�dname�cmd�code�_�stderrs     r�restore_selinux_contextr"sq�����%�%�l�4J�K�T�SX�Y��'�3�3�C�d�Y]�^���a������J�Q�Q�RW�Y]�_e�f�rw�
��	rc���tjddgd��\}}}|r%tjdj	||���|jd�D]}||vs�yy)Nz/usr/sbin/semodulez-lT)rz/SELinux modules list gathering error: '{0}' {1}�
F)rrr�
KcareErrorrr)�
semodule_namer�out�err�lines     r�is_selinux_module_presentr*sl��"�.�.�0D�d�/K�Z^�_�N�D�#�s����� Q� X� X�Y\�^b� c�d�d��	�	�$�����D� ���rc����fd�}|S)Nc�h��t�r td�stjd���|i|��S)N�libcarez:SELinux is enabled but libcare policy module is not loaded)rr*rr%)�args�kwargs�clbls  �r�wrapperz*skip_if_no_selinux_module.<locals>.wrapper(s3�����(A�)�(L��#�#�$`�a�a��T�$�V�$�$r�)r0r1s` r�skip_if_no_selinux_moduler3's���%�
�Nrc��tjjd�rtjdg�\}}}|dk(Sy)Nz/usr/sbin/selinuxenabledFr)r	r
�isfilerr)rr s  rrr0s>��	�w�w�~�~�0�1�"�.�.�0J�/K�L�
��a���1�9��r)r	�rrrrrr"r*r3�cachedrr2rr�<module>r8sB��

�����-�
��������r