On Sun, Jul 09, 2017 at 09:33:58PM +0200, Christian Boltz wrote: > Hello, > > $subject. > > Also make 'ruletypes' a dict pointing to the *Ruleset class, and change > ProfileStorage __init__() to iterate over 'ruleset'. > > > [ 04-move-ruletypes.diff ]
Acked-by: Seth Arnold <[email protected]> Thanks > > === modified file ./utils/apparmor/aa.py > --- utils/apparmor/aa.py 2017-07-09 18:40:49.205839507 +0200 > +++ utils/apparmor/aa.py 2017-07-09 16:33:42.196851342 +0200 > @@ -49,7 +49,7 @@ > RE_PROFILE_UNIX, RE_RULE_HAS_COMMA, > RE_HAS_COMMENT_SPLIT, > strip_quotes, parse_profile_start_line, > re_match_include ) > > -from apparmor.profile_storage import ProfileStorage > +from apparmor.profile_storage import ProfileStorage, ruletypes > > import apparmor.rules as aarules > > @@ -63,8 +63,6 @@ > from apparmor.rule.signal import SignalRule > from apparmor.rule import quote_if_needed > > -ruletypes = ['capability', 'change_profile', 'dbus', 'file', 'network', > 'ptrace', 'rlimit', 'signal'] > - > # setup module translations > from apparmor.translations import init_translation > _ = init_translation() > === modified file ./utils/apparmor/profile_storage.py > --- utils/apparmor/profile_storage.py 2017-07-09 18:40:49.205839507 +0200 > +++ utils/apparmor/profile_storage.py 2017-07-09 18:48:23.944151067 +0200 > @@ -25,6 +25,17 @@ > from apparmor.rule.rlimit import RlimitRuleset > from apparmor.rule.signal import SignalRuleset > > +ruletypes = { > + 'capability': {'ruleset': CapabilityRuleset}, > + 'change_profile': {'ruleset': ChangeProfileRuleset}, > + 'dbus': {'ruleset': DbusRuleset}, > + 'file': {'ruleset': FileRuleset}, > + 'network': {'ruleset': NetworkRuleset}, > + 'ptrace': {'ruleset': PtraceRuleset}, > + 'rlimit': {'ruleset': RlimitRuleset}, > + 'signal': {'ruleset': SignalRuleset}, > +} > + > class ProfileStorage: > '''class to store the content (header, rules, comments) of a profilename > > @@ -36,14 +47,8 @@ > # self.data['info'] isn't used anywhere, but can be helpful in > debugging. > data['info'] = {'profile': profilename, 'hat': hat, 'calledby': > calledby} > > - data['capability'] = CapabilityRuleset() > - data['dbus'] = DbusRuleset() > - data['file'] = FileRuleset() > - data['change_profile'] = ChangeProfileRuleset() > - data['network'] = NetworkRuleset() > - data['ptrace'] = PtraceRuleset() > - data['rlimit'] = RlimitRuleset() > - data['signal'] = SignalRuleset() > + for rule in ruletypes: > + data[rule] = ruletypes[rule]['ruleset']() > > data['alias'] = dict() > data['include'] = dict() > >
signature.asc
Description: PGP signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
