mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
parse_profile_data(): error out on alias inside profile
Defining an alias is only allowed outside of a profile. Also add a parser test with an alias inside a profile.
This commit is contained in:
parent
eca16ae6cf
commit
f910cb5559
2 changed files with 9 additions and 2 deletions
|
@ -0,0 +1,6 @@
|
|||
#=DESCRIPTION alias definition inside a profile
|
||||
#=EXRESULT FAIL
|
||||
|
||||
/bin/foo {
|
||||
alias /tmp -> /var/tmp,
|
||||
}
|
|
@ -2279,8 +2279,9 @@ def parse_profile_data(data, file, do_include):
|
|||
from_name = strip_quotes(matches[0])
|
||||
to_name = strip_quotes(matches[1])
|
||||
|
||||
if profile:
|
||||
profile_data[profile][hat]['alias'][from_name] = to_name
|
||||
if profile and not do_include:
|
||||
raise AppArmorException(_('Syntax Error: Unexpected alias definition found inside profile in file: %(file)s line: %(line)s') % {
|
||||
'file': file, 'line': lineno + 1 })
|
||||
else:
|
||||
if not filelist.get(file, False):
|
||||
filelist[file] = hasher()
|
||||
|
|
Loading…
Add table
Reference in a new issue