mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 13:58:22 +00:00
change_profile_flags: raise AppArmorBug on empty new flag
This commit is contained in:
@@ -639,8 +639,8 @@ def change_profile_flags(prof_filename, program, flag, set_flag):
|
||||
|
||||
found = False
|
||||
|
||||
if newflags and newflags.strip() == '':
|
||||
raise AppArmorBug('New flags for %s contain only whitespace' % prof_filename)
|
||||
if not flag or flag.strip() == '':
|
||||
raise AppArmorBug('New flag for %s is empty' % prof_filename)
|
||||
|
||||
with open_file_read(prof_filename) as f_in:
|
||||
temp_file = tempfile.NamedTemporaryFile('w', prefix=prof_filename, suffix='~', delete=False, dir=profile_dir)
|
||||
|
@@ -367,7 +367,7 @@ class AaTest_change_profile_flags(AaTestWithTempdir):
|
||||
# XXX empty new flag should raise AppArmorBug
|
||||
self._test_change_profile_flags('/foo', '( )', '', True, '', check_new_flags=False)
|
||||
def test_change_profile_flags_invalid_04(self):
|
||||
# with self.assertRaises(AppArmorBug): # XXX empty new flag should raise AppArmorBug
|
||||
with self.assertRaises(AppArmorBug):
|
||||
self._test_change_profile_flags('/foo', 'flags=(complain, audit)', ' ', True, 'audit, complain', check_new_flags=False) # whitespace-only newflags
|
||||
|
||||
def test_change_profile_flags_other_profile(self):
|
||||
|
Reference in New Issue
Block a user