File: //lib/python3/dist-packages/apparmor/rule/__pycache__/change_profile.cpython-310.pyc
o
%`b; � @ sv d dl mZmZ d dlmZmZmZ d dlmZm Z m
Z
mZmZ d dl
mZ e� ZG dd� de�ZG dd� de �Zd S )
� )�RE_PROFILE_CHANGE_PROFILE�strip_quotes)�AppArmorBug�AppArmorException�type_is_str)�BaseRule�BaseRuleset�parse_modifiers�logprof_value_or_all�quote_if_needed)�init_translationc s� e Zd ZdZG dd� de�ZeZdZg d�Z d� fd d
� Z e
dd� �Ze
d
d� �Zddd�Z
dd� Zdd� Zdd� Z� ZS )�ChangeProfileRulez6Class to handle and store a single change_profile rulec @ s e Zd ZdS )z$ChangeProfileRule.__ChangeProfileAllN)�__name__�
__module__�__qualname__� r r �>/usr/lib/python3/dist-packages/apparmor/rule/change_profile.py�__ChangeProfileAll s r �change_profile)�safe� NFr Nc s t t| �j|||||d� |r(|dkr|dkrtd| ��|r$|tjkr(td��|| _d| _d| _|tjkr:d| _n*t |�r\|�
� sFtd ��|�d
�sP|�d�rT|| _ntdt|� ��td
t|� ��d| _
d| _|tjkrtd| _dS t |�r�|�
� r�|| _
dS td��td
t|� ��)zl
CHANGE_PROFILE RULE = 'change_profile' [ [ EXEC MODE ] EXEC COND ] [ -> PROGRAMCHILD ]
)�audit�deny�
allow_keyword�comment� log_eventr �unsafez-Unknown exec mode (%s) in change_profile rulezCExec condition is required when unsafe or safe keywords are presentNFTz+Empty exec condition in change_profile rule�/�@z?Exec condition in change_profile rule does not start with /: %sz.Passed unknown object to ChangeProfileRule: %s�+Empty target profile in change_profile rule)�superr
�__init__r �ALLr �execmode�execcond�
all_execcondsr �strip�
startswith�str�
targetprofile�all_targetprofiles) �selfr# r$ r) r r r r r �� __class__r r r! '