mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 06:45:38 +00:00
Merge branch 'cboltz-mergeprof-hasher-fun' into 'master'
Fix aa-mergeprof crash caused by accidentially initialzed hat See merge request apparmor/apparmor!234 Acked-by: John Johansen <john.johansen@canonical.com> (cherry picked from commit93445ca02d
)bc492533
Fix aa-mergeprof crash caused by accidentially initialzed hat
This commit is contained in:
@@ -54,20 +54,24 @@ class CleanProf(object):
|
|||||||
|
|
||||||
#If different files remove duplicate includes in the other profile
|
#If different files remove duplicate includes in the other profile
|
||||||
if not self.same_file:
|
if not self.same_file:
|
||||||
for inc in includes:
|
if self.other.aa[program].get(hat): # carefully avoid to accidently initialize self.other.aa[program][hat]
|
||||||
if self.other.aa[program][hat]['include'].get(inc, False):
|
for inc in includes:
|
||||||
self.other.aa[program][hat]['include'].pop(inc)
|
if self.other.aa[program][hat]['include'].get(inc, False):
|
||||||
deleted += 1
|
self.other.aa[program][hat]['include'].pop(inc)
|
||||||
|
deleted += 1
|
||||||
|
|
||||||
#Clean up superfluous rules from includes in the other profile
|
#Clean up superfluous rules from includes in the other profile
|
||||||
for inc in includes:
|
for inc in includes:
|
||||||
if not self.profile.include.get(inc, {}).get(inc, False):
|
if not self.profile.include.get(inc, {}).get(inc, False):
|
||||||
apparmor.load_include(inc)
|
apparmor.load_include(inc)
|
||||||
deleted += apparmor.delete_duplicates(self.other.aa[program][hat], inc)
|
if self.other.aa[program].get(hat): # carefully avoid to accidently initialize self.other.aa[program][hat]
|
||||||
|
deleted += apparmor.delete_duplicates(self.other.aa[program][hat], inc)
|
||||||
|
|
||||||
#Clean duplicate rules in other profile
|
#Clean duplicate rules in other profile
|
||||||
for ruletype in apparmor.ruletypes:
|
for ruletype in apparmor.ruletypes:
|
||||||
if not self.same_file:
|
if not self.same_file:
|
||||||
deleted += self.other.aa[program][hat][ruletype].delete_duplicates(self.profile.aa[program][hat][ruletype])
|
if self.other.aa[program].get(hat): # carefully avoid to accidently initialize self.other.aa[program][hat]
|
||||||
|
deleted += self.other.aa[program][hat][ruletype].delete_duplicates(self.profile.aa[program][hat][ruletype])
|
||||||
else:
|
else:
|
||||||
deleted += self.other.aa[program][hat][ruletype].delete_duplicates(None)
|
deleted += self.other.aa[program][hat][ruletype].delete_duplicates(None)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user