mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-29 05:17:59 +00:00
make 'prelog' non-global
It's only used by two functions: - handle_hashlog() - writes to prelog, and now returns it - collapse_log() - reads prelog, and now gets it as parameter
This commit is contained in:
parent
c77426ed62
commit
c5f0097f65
@ -104,7 +104,6 @@ original_aa = hasher()
|
||||
extras = hasher() # Inactive profiles from extras
|
||||
### end our
|
||||
|
||||
prelog = hasher()
|
||||
changed = dict()
|
||||
created = []
|
||||
helpers = dict() # Preserve this between passes # was our
|
||||
@ -888,6 +887,8 @@ def build_x_functions(default, options, exec_toggle):
|
||||
def handle_hashlog(hashlog):
|
||||
'''Copy hashlog content to prelog'''
|
||||
|
||||
prelog = hasher()
|
||||
|
||||
for aamode in hashlog.keys():
|
||||
for full_profile in hashlog[aamode].keys():
|
||||
if hashlog[aamode][full_profile]['final_name'] == '':
|
||||
@ -899,6 +900,8 @@ def handle_hashlog(hashlog):
|
||||
for typ in hashlog[aamode][full_profile].keys():
|
||||
prelog[aamode][profile][hat][typ] = hashlog[aamode][full_profile][typ]
|
||||
|
||||
return prelog
|
||||
|
||||
def ask_addhat(hashlog):
|
||||
'''ask the user about change_hat events (requests to add a hat)'''
|
||||
|
||||
@ -1688,7 +1691,6 @@ def do_logprof_pass(logmark='', passno=0):
|
||||
global active_profiles
|
||||
global sev_db
|
||||
# aa = hasher()
|
||||
# prelog = hasher()
|
||||
# changed = dict()
|
||||
# filelist = hasher()
|
||||
|
||||
@ -1712,11 +1714,11 @@ def do_logprof_pass(logmark='', passno=0):
|
||||
|
||||
ask_exec(hashlog)
|
||||
ask_addhat(hashlog)
|
||||
handle_hashlog(hashlog)
|
||||
prelog = handle_hashlog(hashlog)
|
||||
|
||||
#read_log(logmark)
|
||||
|
||||
log_dict = collapse_log()
|
||||
log_dict = collapse_log(prelog)
|
||||
|
||||
ask_the_questions(log_dict)
|
||||
|
||||
@ -1799,7 +1801,7 @@ def save_profiles():
|
||||
def get_pager():
|
||||
return 'less'
|
||||
|
||||
def collapse_log():
|
||||
def collapse_log(prelog):
|
||||
log_dict = hasher()
|
||||
for aamode in prelog.keys():
|
||||
for profile in prelog[aamode].keys():
|
||||
|
@ -239,9 +239,9 @@ def logfile_to_profile(logfile):
|
||||
|
||||
apparmor.aa.ask_exec(hashlog)
|
||||
apparmor.aa.ask_addhat(hashlog)
|
||||
apparmor.aa.handle_hashlog(hashlog)
|
||||
prelog = apparmor.aa.handle_hashlog(hashlog)
|
||||
|
||||
log_dict = apparmor.aa.collapse_log()
|
||||
log_dict = apparmor.aa.collapse_log(prelog)
|
||||
|
||||
if profile != hat:
|
||||
# log event for a child profile means log_dict only contains the child profile
|
||||
|
Loading…
x
Reference in New Issue
Block a user