mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-28 04:47:53 +00:00
fix regression in {get,set}_profile_flags()
Since the latest change, calling {get,set}_profile_flags() with the profile name failed when attachment was specified ("profile foo /bar"). Catched by the unittests. Also fix a whitespace issue.
This commit is contained in:
parent
059adcdf76
commit
f472b6bb34
@ -617,7 +617,7 @@ def get_profile_flags(filename, program):
|
|||||||
else:
|
else:
|
||||||
profile_glob = AARE(matches['profile'], True)
|
profile_glob = AARE(matches['profile'], True)
|
||||||
flags = matches['flags']
|
flags = matches['flags']
|
||||||
if (program is not None and profile_glob.match(program)) or program is None:
|
if (program is not None and profile_glob.match(program)) or program is None or program == matches['profile']:
|
||||||
return flags
|
return flags
|
||||||
|
|
||||||
raise AppArmorException(_('%s contains no profile') % filename)
|
raise AppArmorException(_('%s contains no profile') % filename)
|
||||||
@ -674,10 +674,11 @@ def set_profile_flags(prof_filename, program, newflags):
|
|||||||
profile_glob = AARE(matches['attachment'], True)
|
profile_glob = AARE(matches['attachment'], True)
|
||||||
else:
|
else:
|
||||||
profile_glob = AARE(matches['profile'], True)
|
profile_glob = AARE(matches['profile'], True)
|
||||||
if (program is not None and profile_glob.match(program)) or program is None:
|
if (program is not None and profile_glob.match(program)) or program is None or program == matches['profile']:
|
||||||
found = True
|
found = True
|
||||||
if program is not None and program != profile:
|
if program is not None and program != profile:
|
||||||
aaui.UI_Info(_('Warning: profile %s represents multiple programs') % profile)
|
aaui.UI_Info(_('Warning: profile %s represents multiple programs') % profile)
|
||||||
|
|
||||||
header_data = {
|
header_data = {
|
||||||
'attachment': matches['attachment'] or '',
|
'attachment': matches['attachment'] or '',
|
||||||
'flags': newflags,
|
'flags': newflags,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user