utils: fix writing alias rules

Merge remote-tracking branch 'cboltz/cboltz-fix-write-alias' from
Christian Boltz.

Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
PR: https://gitlab.com/apparmor/apparmor/merge_requests/119
This commit is contained in:
Steve Beattie 2018-05-08 07:46:20 -07:00
commit 0b259753b8
Failed to generate hash of commit
3 changed files with 5 additions and 1 deletions

View file

@ -2635,7 +2635,7 @@ def write_pair(prof_data, depth, allow, name, prefix, sep, tail, fn):
if ref.get(name, False):
for key in sorted(ref[name].keys()):
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():
data.append('')

View file

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

View file

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