2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

ask_exec(): don't overwrite 'hat' in cx handling

Otherwise we'd have to reset 'hat' in the next round of the for loop.

Using 'exec_target' instead of 'hat' in the cx code is much easier.
This commit is contained in:
Christian Boltz
2019-05-08 23:09:31 +02:00
parent d2663b148a
commit 3b77d63556

View File

@@ -1181,20 +1181,19 @@ def ask_exec(hashlog):
if 'i' in exec_mode:
ynans = aaui.UI_YesNo(_('A profile for %s does not exist.\nDo you want to create one?') % exec_target, 'n')
if ynans == 'y':
hat = exec_target
if not aa[profile].get(hat, False):
stub_profile = create_new_profile(hat, True)
aa[profile][hat] = stub_profile[hat][hat]
if not aa[profile].get(exec_target, False):
stub_profile = create_new_profile(exec_target, True)
aa[profile][exec_target] = stub_profile[exec_target][exec_target]
aa[profile][hat]['profile'] = True
aa[profile][exec_target]['profile'] = True
if profile != hat:
aa[profile][hat]['flags'] = aa[profile][profile]['flags']
if profile != exec_target:
aa[profile][exec_target]['flags'] = aa[profile][profile]['flags']
aa[profile][hat]['flags'] = 'complain'
aa[profile][exec_target]['flags'] = 'complain'
file_name = aa[profile][profile]['filename']
filelist[file_name]['profiles'][profile][hat] = True
filelist[file_name]['profiles'][profile][exec_target] = True
elif ans.startswith('CMD_ux'):
continue