HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/libexec/kcare/python/kcarectl/__pycache__/selinux.cpython-38.pyc
U

n�h��@sRddlZddlmZmZmZmZdd�Zdd�Zdd	�Zd
d�Z	ej
dd
��ZdS)�N�)�errors�	log_utils�
process_utils�utilscCs"tj�|�\}}tj�|d|�S)Nztmp.)�os�path�split�join)�fname�head�tail�r�-/usr/libexec/kcare/python/kcarectl/selinux.py�selinux_safe_tmpname
srcCsNt�rJt�dd�d|g}tj|ddd�\}}}|rJtjd�|||�dd�dS)	NZ
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�_�stderrrrr�restore_selinux_contexts�rcCsPtjddgdd�\}}}|r.t�d�||���|�d�D]}||kr8dSq8dS)Nz/usr/sbin/semodulez-lT)rz/SELinux modules list gathering error: '{0}' {1}�
F)rrr�
KcareErrorrr	)Z
semodule_namer�out�err�linerrr�is_selinux_module_presentsr$cs�fdd�}|S)Ncs"t�rtd�st�d���||�S)N�libcarez:SELinux is enabled but libcare policy module is not loaded)rr$rr )�args�kwargs��clblrr�wrapper%s
z*skip_if_no_selinux_module.<locals>.wrapperr)r)r*rr(r�skip_if_no_selinux_module$sr+cCs,tj�d�r t�dg�\}}}ndS|dkS)Nz/usr/sbin/selinuxenabledFr)rr�isfilerr)rrrrrr-sr)r�rrrrrrr$r+�cachedrrrrr�<module>s