2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 22:35:35 +00:00

set_profile_flags(): allow named profiles without attachment

Named profiles can come without an attachment path specified, for
example
    profile foo {...}

This patch fixes set_profile_flags() to actually allow that instead of
erroring out.

References:
- https://bugzilla.opensuse.org/show_bug.cgi?id=1096269 comment #3 and #4
- https://bugs.launchpad.net/apparmor/+bug/1775591
This commit is contained in:
Christian Boltz
2018-07-10 01:00:00 +02:00
parent 8fc0ff7ffc
commit 0dca959c6b

View File

@@ -674,7 +674,8 @@ def set_profile_flags(prof_filename, program, newflags):
if (matches['attachment'] is not None):
profile_glob = AARE(matches['attachment'], True)
else:
profile_glob = AARE(matches['profile'], True)
profile_glob = AARE(matches['profile'], False) # named profiles can come without an attachment path specified ("profile foo {...}")
if (program is not None and profile_glob.match(program)) or program is None or program == matches['profile']:
found = True
if program is not None and program != profile: