2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

ProfileStorage: Store empty xattrs as empty string

... instead of None.

This avoids the need to allow type changes (None vs. str).

Also adjust the tests accordingly.
This commit is contained in:
Christian Boltz
2021-08-15 13:43:19 +02:00
parent bbe52a1eec
commit 337ebcd032
2 changed files with 8 additions and 8 deletions

View File

@@ -122,12 +122,12 @@ class TestSetInvalid(AATest):
class AaTest_parse_profile_start(AATest):
tests = [
# profile start line profile hat profile hat attachment xattrs flags pps_set_hat_external
(('/foo {', None, None), ('/foo', '/foo', None, None, None, False)),
(('/foo (complain) {', None, None), ('/foo', '/foo', None, None, 'complain', False)),
(('profile foo /foo {', None, None), ('foo', 'foo', '/foo', None, None, False)), # named profile
(('profile /foo {', '/bar', None), ('/bar', '/foo', None, None, None, False)), # child profile
(('/foo//bar {', None, None), ('/foo', 'bar', None, None, None, True )), # external hat
(('profile "/foo" (complain) {', None, None), ('/foo', '/foo', None, None, 'complain', False)),
(('/foo {', None, None), ('/foo', '/foo', None, '', None, False)),
(('/foo (complain) {', None, None), ('/foo', '/foo', None, '', 'complain', False)),
(('profile foo /foo {', None, None), ('foo', 'foo', '/foo', '', None, False)), # named profile
(('profile /foo {', '/bar', None), ('/bar', '/foo', None, '', None, False)), # child profile
(('/foo//bar {', None, None), ('/foo', 'bar', None, '', None, True )), # external hat
(('profile "/foo" (complain) {', None, None), ('/foo', '/foo', None, '', 'complain', False)),
(('profile "/foo" xattrs=(user.bar=bar) {', None, None), ('/foo', '/foo', None, 'user.bar=bar', None, False)),
(('profile "/foo" xattrs=(user.bar=bar user.foo=*) {', None, None), ('/foo', '/foo', None, 'user.bar=bar user.foo=*', None, False)),
(('/usr/bin/xattrs-test xattrs=(myvalue="foo.bar") {', None, None), ('/usr/bin/xattrs-test', '/usr/bin/xattrs-test', None, 'myvalue="foo.bar"', None, False)),