[apparmor] [patch] Store filename for includes and hats

Christian Boltz apparmor at cboltz.de
Fri Oct 16 20:15:42 UTC 2015


Hello,

$subject ;-)

This also means the duplicate detection can use the hat's filename instead
of the (possibly wrong) main profile's filename.


[ 92-store-filename-for-includes-and-hats.diff ]

--- utils/apparmor/aa.py        2015-10-11 20:35:28.502666115 +0200
+++ utils/apparmor/aa.py        2015-10-16 22:10:06.456103610 +0200
@@ -2527,8 +2527,7 @@
             for hat in profile_data[p].keys():
                 if profiles[p].get(hat, False):
                     raise AppArmorException(_("Conflicting profiles for %s defined in two files:\n- %s\n- %s") %
-                            # 'filename' is not set for hats, therefore print the filename of the main profile
-                            (combine_name(p, hat), profiles[p][p]['filename'], profile_data[p][p]['filename']))
+                            (combine_name(p, hat), profiles[p][hat]['filename'], profile_data[p][hat]['filename']))
 
         profiles[p] = deepcopy(profile_data[p])
 
@@ -2581,6 +2580,7 @@
         profile = file
         hat = file
         profile_data[profile][hat] = profile_storage()
+        profile_data[profile][hat]['filename'] = file
 
     for lineno, line in enumerate(data):
         line = line.strip()
@@ -3004,6 +3004,7 @@
             # nevertheless, just to be sure, don't overwrite existing profile_data.
             if not profile_data[profile].get(hat, False):
                 profile_data[profile][hat] = profile_storage()
+                profile_data[profile][hat]['filename'] = file
 
             flags = matches.group('flags')
 


Regards,

Christian Boltz
-- 
"Kann mir jemand seine Erfahrungen mit dem Gigaset Router schildern.
Ich möchte mit dem Gerät meine Kaffemaschine Mitropa 3000+ (SW-Stand
47.11 / HW-Rev.: 08/15) mit Ethernet-Interface fernbedienen, ist das
Gerät geeignet und wie muß ich vorgehen?" [Eric Scheen in suse-linux]




More information about the AppArmor mailing list