mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Fix regressions caused by init_aa()
With the init_aa() patch series commited, minitools_test.py showed several test failures - which effectively means the -d option of aa-complain, aa-cleanprof etc. was broken. These failures were caused by - calling init_aa() too late in tools.py - _after_ setting the profiledir, which then got overwritten by init_aa() - calling init_aa() twice (because apparmor.aa gets imported in two modules used by aa-cleanprof), which overwrote the manually set values on the second run This patch fixes the call order in tools.py and adds a check to init_aa() so that it only runs once and ignores additional calls. Acked-by: Tyler Hicks <tyhicks@canonical.com> Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
parent
054d8f795f
commit
566b053bdf
2 changed files with 5 additions and 2 deletions
|
@ -3749,6 +3749,9 @@ def init_aa(confdir="/etc/apparmor"):
|
|||
global extra_profile_dir
|
||||
global parser
|
||||
|
||||
if CONFDIR:
|
||||
return # config already initialized (and possibly changed afterwards), so don't overwrite the config variables
|
||||
|
||||
CONFDIR = confdir
|
||||
conf = apparmor.config.Config('ini', CONFDIR)
|
||||
cfg = conf.read_config('logprof.conf')
|
||||
|
|
|
@ -24,6 +24,8 @@ _ = init_translation()
|
|||
|
||||
class aa_tools:
|
||||
def __init__(self, tool_name, args):
|
||||
apparmor.init_aa()
|
||||
|
||||
self.name = tool_name
|
||||
self.profiledir = args.dir
|
||||
self.profiling = args.program
|
||||
|
@ -31,8 +33,6 @@ class aa_tools:
|
|||
self.silent = None
|
||||
self.do_reload = args.do_reload
|
||||
|
||||
apparmor.init_aa()
|
||||
|
||||
if tool_name in ['audit']:
|
||||
self.remove = args.remove
|
||||
elif tool_name == 'autodep':
|
||||
|
|
Loading…
Add table
Reference in a new issue