2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-29 13:28:19 +00:00

Fix writing alias rules

write_pair() ignored the 'tail' parameter, which resulted in writing
invalid alias rules (without the trailing comma).

Also add an alias to test/cleanprof.* to ensure it doesn't break again.
This commit is contained in:
Christian Boltz 2018-05-06 19:35:22 +02:00
parent eca16ae6cf
commit ae4ab62855
No known key found for this signature in database
GPG Key ID: C6A682EA63C82F1C
3 changed files with 5 additions and 1 deletions

View File

@ -2634,7 +2634,7 @@ def write_pair(prof_data, depth, allow, name, prefix, sep, tail, fn):
if ref.get(name, False): if ref.get(name, False):
for key in sorted(ref[name].keys()): for key in sorted(ref[name].keys()):
value = fn(ref[name][key]) # eval('%s(%s)' % (fn, ref[name][key])) value = fn(ref[name][key]) # eval('%s(%s)' % (fn, ref[name][key]))
data.append('%s%s%s%s%s%s' % (pre, allow, prefix, key, sep, value)) data.append('%s%s%s%s%s%s%s' % (pre, allow, prefix, key, sep, value, tail))
if ref[name].keys(): if ref[name].keys():
data.append('') data.append('')

View File

@ -1,6 +1,8 @@
# A simple test comment which will persist # A simple test comment which will persist
#include <tunables/global> #include <tunables/global>
alias /foo -> /bar ,
/usr/bin/a/simple/cleanprof/test/profile { /usr/bin/a/simple/cleanprof/test/profile {
# Just for the heck of it, this comment wont see the day of light # Just for the heck of it, this comment wont see the day of light
#include <abstractions/base> #include <abstractions/base>

View File

@ -1,3 +1,5 @@
alias /foo -> /bar,
#include <tunables/global> #include <tunables/global>
# A simple test comment which will persist # A simple test comment which will persist