mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 06:16:03 +00:00
Add support for --show-matching-path and xattrs
The new option --show-matching-path shows a path that matches in the host filesystem, to prove that the profile is indeed used. Also, profiles' xattrs are now parsed into a dict and are taken in consideration when looking for matching profiles. Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
This commit is contained in:
committed by
Christian Boltz
parent
db376c0458
commit
b46f7a426c
@@ -552,7 +552,7 @@ class AaTest_parse_profile_data(AATest):
|
||||
self.assertEqual(prof['/foo']['name'], '/foo')
|
||||
self.assertEqual(prof['/foo']['filename'], 'somefile')
|
||||
self.assertEqual(prof['/foo']['flags'], None)
|
||||
self.assertEqual(prof['/foo']['xattrs'], 'user.bar=bar')
|
||||
self.assertEqual(prof['/foo']['xattrs'], {'user.bar': 'bar'})
|
||||
|
||||
def test_parse_xattrs_02(self):
|
||||
prof = parse_profile_data('/foo xattrs=(user.bar=bar user.foo=*) {\n}\n'.split(), 'somefile', False, False)
|
||||
@@ -561,7 +561,7 @@ class AaTest_parse_profile_data(AATest):
|
||||
self.assertEqual(prof['/foo']['name'], '/foo')
|
||||
self.assertEqual(prof['/foo']['filename'], 'somefile')
|
||||
self.assertEqual(prof['/foo']['flags'], None)
|
||||
self.assertEqual(prof['/foo']['xattrs'], 'user.bar=bar user.foo=*')
|
||||
self.assertEqual(prof['/foo']['xattrs'], {'user.bar': 'bar', 'user.foo': '*'})
|
||||
|
||||
def test_parse_xattrs_03(self):
|
||||
d = '/foo xattrs=(user.bar=bar) flags=(complain) {\n}\n'
|
||||
@@ -571,7 +571,7 @@ class AaTest_parse_profile_data(AATest):
|
||||
self.assertEqual(prof['/foo']['name'], '/foo')
|
||||
self.assertEqual(prof['/foo']['filename'], 'somefile')
|
||||
self.assertEqual(prof['/foo']['flags'], 'complain')
|
||||
self.assertEqual(prof['/foo']['xattrs'], 'user.bar=bar')
|
||||
self.assertEqual(prof['/foo']['xattrs'], {'user.bar': 'bar'})
|
||||
|
||||
def test_parse_xattrs_04(self):
|
||||
with self.assertRaises(AppArmorException):
|
||||
|
Reference in New Issue
Block a user