mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 14:25:52 +00:00
ProfileList addProfile(): always hand over ProfileStorage
... and make it non-optional Note that read_profile() in aa.py skips child profiles and hats, therefore active_profiles for now only contains the main profiles.
This commit is contained in:
@@ -511,7 +511,7 @@ def autodep(bin_name, pname=''):
|
|||||||
if not attachment and pname.startswith('/'):
|
if not attachment and pname.startswith('/'):
|
||||||
attachment = pname # use name as name and attachment
|
attachment = pname # use name as name and attachment
|
||||||
|
|
||||||
active_profiles.add_profile(file, pname, attachment)
|
active_profiles.add_profile(file, pname, attachment, profile_data[pname])
|
||||||
|
|
||||||
if os.path.isfile(profile_dir + '/abi/4.0'):
|
if os.path.isfile(profile_dir + '/abi/4.0'):
|
||||||
active_profiles.add_abi(file, AbiRule('abi/4.0', False, True))
|
active_profiles.add_abi(file, AbiRule('abi/4.0', False, True))
|
||||||
@@ -1675,7 +1675,7 @@ def read_profile(file, active_profile, read_error_fatal=False):
|
|||||||
if not attachment and profile.startswith('/'):
|
if not attachment and profile.startswith('/'):
|
||||||
attachment = profile # use profile as name and attachment
|
attachment = profile # use profile as name and attachment
|
||||||
|
|
||||||
active_profiles.add_profile(filename, profile, attachment)
|
active_profiles.add_profile(filename, profile, attachment, profile_data[profile])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for profile in profile_data:
|
for profile in profile_data:
|
||||||
|
@@ -63,7 +63,7 @@ class ProfileList:
|
|||||||
for rule in preamble_ruletypes:
|
for rule in preamble_ruletypes:
|
||||||
self.files[filename][rule] = preamble_ruletypes[rule]['ruleset']()
|
self.files[filename][rule] = preamble_ruletypes[rule]['ruleset']()
|
||||||
|
|
||||||
def add_profile(self, filename, profile_name, attachment, prof_storage=None):
|
def add_profile(self, filename, profile_name, attachment, prof_storage):
|
||||||
"""Add the given profile and attachment to the list"""
|
"""Add the given profile and attachment to the list"""
|
||||||
|
|
||||||
if not filename:
|
if not filename:
|
||||||
@@ -72,7 +72,7 @@ class ProfileList:
|
|||||||
if not profile_name and not attachment:
|
if not profile_name and not attachment:
|
||||||
raise AppArmorBug('Neither profile name or attachment given')
|
raise AppArmorBug('Neither profile name or attachment given')
|
||||||
|
|
||||||
if type(prof_storage) is not ProfileStorage and prof_storage is not None:
|
if type(prof_storage) is not ProfileStorage:
|
||||||
raise AppArmorBug('Invalid profile type: %s' % type(prof_storage))
|
raise AppArmorBug('Invalid profile type: %s' % type(prof_storage))
|
||||||
|
|
||||||
if profile_name in self.profile_names:
|
if profile_name in self.profile_names:
|
||||||
|
Reference in New Issue
Block a user