2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

merge set_profile_flags() into change_profile_flags()

(and adjust a few comments in profile_storage.py)
This commit is contained in:
Christian Boltz
2018-07-25 22:25:38 +02:00
parent abd124c00d
commit c016fc6656
2 changed files with 4 additions and 7 deletions

View File

@@ -623,16 +623,13 @@ def get_profile_flags(filename, program):
raise AppArmorException(_('%s contains no profile') % filename)
def change_profile_flags(filename, program, flag, set_flag):
old_flags = get_profile_flags(filename, program)
def change_profile_flags(prof_filename, program, flag, set_flag):
old_flags = get_profile_flags(prof_filename, program)
newflags = add_or_remove_flag(old_flags, flag, set_flag)
newflags = ', '.join(newflags)
set_profile_flags(filename, program, newflags)
def set_profile_flags(prof_filename, program, newflags):
"""Reads the old profile file and updates the flags accordingly"""
# TODO: count the number of matching lines (separated by profile and hat?) and return it
# so that code calling this function can make sure to only report success if there was a match

View File

@@ -70,9 +70,9 @@ class ProfileStorage:
data['attachment'] = ''
data['flags'] = ''
data['external'] = False
data['header_comment'] = '' # currently only set by set_profile_flags()
data['header_comment'] = '' # currently only set by change_profile_flags()
data['initial_comment'] = ''
data['profile_keyword'] = False # currently only set by set_profile_flags()
data['profile_keyword'] = False # currently only set by change_profile_flags()
data['profile'] = False # profile or hat?
data['allow'] = dict()