<div dir="ltr"><div><div><div><div>Hello,<br><br></div>The cleanprofile.py has an apparmor import, this patch modifies the import to make it consistent with the rest of modules.<br><br>=== modified file 'utils/apparmor/cleanprofile.py'<br>--- utils/apparmor/cleanprofile.py      2015-04-26 19:54:38 +0000<br>+++ utils/apparmor/cleanprofile.py      2015-06-07 17:10:07 +0000<br>@@ -13,13 +13,13 @@<br> # ----------------------------------------------------------------------<br> import re<br> <br>-import apparmor<br>+import apparmor.aa as apparmor<br> <br> class Prof(object):<br>     def __init__(self, filename):<br>-        self.aa = apparmor.aa.aa<br>-        self.filelist = apparmor.aa.filelist<br>-        self.include = apparmor.aa.include<br>+        self.aa = apparmor.aa<br>+        self.filelist = apparmor.filelist<br>+        self.include = apparmor.include<br>         self.filename = filename<br> <br> class CleanProf(object):<br>@@ -61,8 +61,8 @@<br>             #Clean up superfluous rules from includes in the other profile<br>             for inc in includes:<br>                 if not self.profile.include.get(inc, {}).get(inc, False):<br>-                    apparmor.aa.load_include(inc)<br>-                deleted += apparmor.aa.delete_duplicates(self.other.aa[program][hat], inc)<br>+                    apparmor.load_include(inc)<br>+                deleted += apparmor.delete_duplicates(self.other.aa[program][hat], inc)<br> <br>             #Clean duplicate rules in other profile<br>             if not self.same_file:<br>@@ -88,19 +88,19 @@<br>                 cm = profile[allow]['path'][rule]['mode']<br>                 am = profile[allow]['path'][rule]['audit']<br>                 # If modes of rule are a superset of rules implied by entry we can safely remove it<br>-                if apparmor.aa.mode_contains(cm, profile_other[allow]['path'][entry]['mode']) and apparmor.aa.mode_contains(am, profile_other[allow]['path'][entry]['audit']):<br>+                if apparmor.mode_contains(cm, profile_other[allow]['path'][entry]['mode']) and apparmor.mode_contains(am, profile_other[allow]['path'][entry]['audit']):<br>                     if not same_profile:<br>                         deleted.append(entry)<br>                 continue<br>             if re.search('#?\s*include', rule) or re.search('#?\s*include', entry):<br>                 continue<br>             # Check if the rule implies entry<br>-            if apparmor.aa.matchliteral(rule, entry):<br>+            if apparmor.matchliteral(rule, entry):<br>                 # Check the modes<br>                 cm = profile[allow]['path'][rule]['mode']<br>                 am = profile[allow]['path'][rule]['audit']<br>                 # If modes of rule are a superset of rules implied by entry we can safely remove it<br>-                if apparmor.aa.mode_contains(cm, profile_other[allow]['path'][entry]['mode']) and apparmor.aa.mode_contains(am, profile_other[allow]['path'][entry]['audit']):<br>+                if apparmor.mode_contains(cm, profile_other[allow]['path'][entry]['mode']) and apparmor.mode_contains(am, profile_other[allow]['path'][entry]['audit']):<br>                     deleted.append(entry)<br> <br>     for entry in deleted:<br><br></div>Thanks.<br><br></div>Regards,<br><br></div>Kshitij Gupta<br></div>