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

Merge branch 'cboltz-fix-complain-named-profiles' into 'master'

set_profile_flags(): allow named profiles without attachment

See merge request apparmor/apparmor!142

Acked-by: John Johansen <john.johansen@canonical.com>


(cherry picked from commit c66a1a972c)

0dca959c set_profile_flags(): allow named profiles without attachment
This commit is contained in:
John Johansen
2018-08-07 10:00:49 +00:00
committed by John Johansen
parent baee295e63
commit 995c0e96f8

View File

@@ -643,6 +643,11 @@ def change_profile_flags(prof_filename, program, flag, set_flag):
newflags = ', '.join(add_or_remove_flag(old_flags, flag, set_flag))
if profile == program or program is None:
profile_glob = AARE(matches['attachment'], True)
else:
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
header_data = {
'attachment': matches['attachment'] or '',