HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/apparmor/rule/__pycache__/alias.cpython-310.pyc
o

%`bB�@srddlmZmZddlmZmZmZddlmZm	Z	m
Z
mZddlm
Z
e
�ZGdd�de�ZGdd�de	�Zd	S)
�)�RE_PROFILE_ALIAS�strip_quotes)�AppArmorBug�AppArmorException�type_is_str)�BaseRule�BaseRuleset�
parse_comment�quote_if_needed)�init_translationcsdeZdZdZdZ		d�fdd�	Zedd	��Zed
d��Zdd
d�Z	dd�Z
dd�Zdd�Z�Z
S)�	AliasRulez-Class to handle and store a single alias rule�aliasF�Ncs�tt|�j|||||d�|rtd|jj��|r!td|jj��t|�s/td|jj|f��|s;td|jj|f��|�d�sDtd��t|�sRtd|jj|f��|s^td	|jj|f��|�d�sgtd
��||_	||_
dS)N)�audit�deny�
allow_keyword�comment�	log_eventz(Attempt to initialize %s with audit flagz'Attempt to initialize %s with deny flagz+Passed unknown type for orig_path to %s: %sz Passed empty orig_path to %s: %s�/z!Alias path doesn't start with '/'z(Passed unknown type for target to %s: %szPassed empty target to %s: %sz#Alias target doesn't start with '/')�superr�__init__r�	__class__�__name__rr�
startswith�	orig_path�target)�selfrrrrrrr�r��5/usr/lib/python3/dist-packages/apparmor/rule/alias.pyrs.�


zAliasRule.__init__cCs
t�|�S)N)r�search)�cls�raw_rulerrr�_match<s
zAliasRule._matchcCs^|�|�}|sttd�|��t|�}t|�d����}t|�d����}t||ddd|d�S)z#parse raw_rule and return AliasRulezInvalid alias rule '%s'rrF)rrrr)r#r�_r	r�group�stripr)r!r"�matchesrrrrrr�_parse@s
�zAliasRule._parsercCs"d|}d|t|j�t|j�fS)z)return rule (in clean/default formatting)z  z%salias %s -> %s,)r
rr)r�depth�spacerrr�	get_cleanPszAliasRule.get_cleancCs|�|d�S)z2check if other_rule is covered by this rule objectF)�is_equal_localvars)r�
other_rulerrr�is_covered_localvarsWszAliasRule.is_covered_localvarscCs@t|�tkstdt|���|j|jkrdS|j|jkrdSdS)z)compare if rule-specific aliass are equalzPassed non-alias rule: %sFT)�typerr�strrr)r�rule_obj�strictrrrr,]szAliasRule.is_equal_localvarscCs g}|td�d|j|jfgS)N�Aliasz%s -> %s)r$rr)r�headersrrr�logprof_header_localvarsks�z"AliasRule.logprof_header_localvars)FFFrN)r)r�
__module__�__qualname__�__doc__�	rule_namer�classmethodr#r(r+r.r,r5�
__classcell__rrrrrs�


rc@seZdZdZdS)�AliasRulesetz5Class to handle and store a collection of alias rulesN)rr6r7r8rrrrr<rsr<N)�apparmor.regexrr�apparmor.commonrrr�
apparmor.rulerrr	r
�apparmor.translationsrr$rr<rrrr�<module>sZ