File apparmor-parser-removal-whitespace-fix of Package apparmor-parser
From: Jeff Mahoney <jeffm@suse.com>
Subject: apparmor-parser: Fix handling of removing profiles with whitespace
References: bnc#510740
The loop that iterates over the profile list doesn't properly handle
whitespace in the profile name.
This patch properly handles it line-by-line instead of using whitespace
as a separator.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
rc.apparmor.functions | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/rc.apparmor.functions
+++ b/rc.apparmor.functions
@@ -378,7 +378,7 @@ remove_profiles() {
#them so stor to tmp first
MODULE_PLIST=$(mktemp ${APPARMOR_TMPDIR}/tmp.XXXXXXXX)
sed -e "s/ (\(enforce\|complain\))$//" "$SFS_MOUNTPOINT/profiles" | sort >"$MODULE_PLIST"
- cat "$MODULE_PLIST" | while read profile ; do
+ cat "$MODULE_PLIST" | while IFS= read profile ; do
echo -n "$profile" > "$SFS_MOUNTPOINT/.remove"
rc=$?
if [ ${rc} -ne 0 ] ; then
@@ -435,7 +435,7 @@ __apparmor_restart() {
profiles_names_list ${PNAMES_LIST}
MODULE_PLIST=$(mktemp ${APPARMOR_TMPDIR}/tmp.XXXXXXXX)
sed -e "s/ (\(enforce\|complain\))$//" "$SFS_MOUNTPOINT/profiles" | sort >"$MODULE_PLIST"
- sort "$PNAMES_LIST" | comm -2 -3 "$MODULE_PLIST" - | while read profile ; do
+ sort "$PNAMES_LIST" | comm -2 -3 "$MODULE_PLIST" - | while IFS= read profile ; do
echo -n "$profile" > "$SFS_MOUNTPOINT/.remove"
done
rm "$MODULE_PLIST"