From ae4ab628551afa4614cc7cb41daf1d5a67e417bb Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 6 May 2018 19:35:22 +0200 Subject: [PATCH] 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. --- utils/apparmor/aa.py | 2 +- utils/test/cleanprof_test.in | 2 ++ utils/test/cleanprof_test.out | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py index b699da434..a33e8896b 100644 --- a/utils/apparmor/aa.py +++ b/utils/apparmor/aa.py @@ -2634,7 +2634,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('') diff --git a/utils/test/cleanprof_test.in b/utils/test/cleanprof_test.in index 3931a18d9..9be6e6559 100644 --- a/utils/test/cleanprof_test.in +++ b/utils/test/cleanprof_test.in @@ -1,6 +1,8 @@ # A simple test comment which will persist #include + 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 diff --git a/utils/test/cleanprof_test.out b/utils/test/cleanprof_test.out index 730cd5b8d..d5102d3dc 100644 --- a/utils/test/cleanprof_test.out +++ b/utils/test/cleanprof_test.out @@ -1,3 +1,5 @@ +alias /foo -> /bar, + #include # A simple test comment which will persist