mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-04 08:15:21 +00:00
Fix error when choosing named exec with plane profile names
When a user choooses to execute to a named profile (not: named child), make sure to get the profile filename in the correct way to avoid a crash. Fixes: https://gitlab.com/apparmor/apparmor/-/issues/314
This commit is contained in:
@@ -1038,7 +1038,12 @@ def ask_exec(hashlog):
|
|||||||
hashlog[aamode][target_profile]['final_name'] = exec_target
|
hashlog[aamode][target_profile]['final_name'] = exec_target
|
||||||
|
|
||||||
# Check profile exists for px
|
# Check profile exists for px
|
||||||
if not os.path.exists(get_profile_filename_from_attachment(exec_target, True)):
|
if exec_target.startswith(('/', '@', '{')):
|
||||||
|
prof_filename = get_profile_filename_from_attachment(exec_target, True)
|
||||||
|
else: # named exec
|
||||||
|
prof_filename = get_profile_filename_from_profile_name(exec_target, True)
|
||||||
|
|
||||||
|
if not os.path.exists(prof_filename):
|
||||||
ynans = 'y'
|
ynans = 'y'
|
||||||
if 'i' in exec_mode:
|
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')
|
ynans = aaui.UI_YesNo(_('A profile for %s does not exist.\nDo you want to create one?') % exec_target, 'n')
|
||||||
|
Reference in New Issue
Block a user