mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 22:05:27 +00:00
Use AbiRule in ProfileStorage (for abi rules inside profiles)
This also drops the last usage of write_abi(), drop it.
This commit is contained in:
@@ -1919,7 +1919,7 @@ def parse_profile_data(data, file, do_include):
|
||||
|
||||
elif AbiRule.match(line):
|
||||
if profile:
|
||||
profile_data[profile][hat]['abi'].append(line)
|
||||
profile_data[profile][hat]['abi'].add(AbiRule.parse(line))
|
||||
else:
|
||||
active_profiles.add_abi(file, AbiRule.parse(line))
|
||||
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
from apparmor.common import AppArmorBug, type_is_str
|
||||
|
||||
from apparmor.rule.abi import AbiRuleset
|
||||
from apparmor.rule.capability import CapabilityRuleset
|
||||
from apparmor.rule.change_profile import ChangeProfileRuleset
|
||||
from apparmor.rule.dbus import DbusRuleset
|
||||
@@ -33,6 +34,7 @@ from apparmor.translations import init_translation
|
||||
_ = init_translation()
|
||||
|
||||
ruletypes = {
|
||||
'abi': {'ruleset': AbiRuleset},
|
||||
'inc_ie': {'ruleset': IncludeRuleset},
|
||||
'capability': {'ruleset': CapabilityRuleset},
|
||||
'change_profile': {'ruleset': ChangeProfileRuleset},
|
||||
@@ -60,7 +62,6 @@ class ProfileStorage:
|
||||
data[rule] = ruletypes[rule]['ruleset']()
|
||||
|
||||
data['alias'] = dict()
|
||||
data['abi'] = []
|
||||
data['include'] = dict()
|
||||
data['lvar'] = dict()
|
||||
|
||||
@@ -141,7 +142,6 @@ class ProfileStorage:
|
||||
|
||||
# "old" write functions for rule types not implemented as *Rule class yet
|
||||
write_functions = {
|
||||
'abi': write_abi,
|
||||
'alias': write_alias,
|
||||
'include': write_includes,
|
||||
'lvar': write_list_vars,
|
||||
@@ -221,17 +221,6 @@ def write_list_vars(ref, depth):
|
||||
|
||||
return data
|
||||
|
||||
def write_abi(ref, depth):
|
||||
pre = ' ' * depth
|
||||
data = []
|
||||
|
||||
if ref.get('abi'):
|
||||
for line in ref.get('abi'):
|
||||
data.append('%s%s' % (pre, line))
|
||||
data.append('')
|
||||
|
||||
return data
|
||||
|
||||
def write_alias(prof_data, depth):
|
||||
pre = ' ' * depth
|
||||
data = []
|
||||
|
@@ -13,7 +13,7 @@ include if exists <tunables/nothing>
|
||||
|
||||
|
||||
/usr/bin/a/simple/cleanprof/test/profile {
|
||||
abi "abi/4.20" ,
|
||||
abi "abi/4.20",
|
||||
|
||||
#include <abstractions/base>
|
||||
|
||||
|
Reference in New Issue
Block a user