mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-02 15:25:27 +00:00
merge set_profile_flags() into change_profile_flags()
(and adjust a few comments in profile_storage.py)
This commit is contained in:
@@ -623,16 +623,13 @@ def get_profile_flags(filename, program):
|
|||||||
|
|
||||||
raise AppArmorException(_('%s contains no profile') % filename)
|
raise AppArmorException(_('%s contains no profile') % filename)
|
||||||
|
|
||||||
def change_profile_flags(filename, program, flag, set_flag):
|
def change_profile_flags(prof_filename, program, flag, set_flag):
|
||||||
old_flags = get_profile_flags(filename, program)
|
old_flags = get_profile_flags(prof_filename, program)
|
||||||
|
|
||||||
newflags = add_or_remove_flag(old_flags, flag, set_flag)
|
newflags = add_or_remove_flag(old_flags, flag, set_flag)
|
||||||
|
|
||||||
newflags = ', '.join(newflags)
|
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"""
|
"""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
|
# 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
|
# so that code calling this function can make sure to only report success if there was a match
|
||||||
|
@@ -70,9 +70,9 @@ class ProfileStorage:
|
|||||||
data['attachment'] = ''
|
data['attachment'] = ''
|
||||||
data['flags'] = ''
|
data['flags'] = ''
|
||||||
data['external'] = False
|
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['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['profile'] = False # profile or hat?
|
||||||
|
|
||||||
data['allow'] = dict()
|
data['allow'] = dict()
|
||||||
|
Reference in New Issue
Block a user