mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-29 13:28:19 +00:00
utils: fix removing unknown profiles that contain spaces
aa-remove-unknown doesn't deal properly with profiles that contain spaces in their names. Using profile "MongoDB Compass" as an example, awk's sub returns the number of matches - either 1 or 0 and replaces the actual string ($0) with the substitution. By accessing the return of sub with $, awk would be accessing $1 which would return only "MongoDB". Fix this by using $0 instead of $str. Fixes: https://gitlab.com/apparmor/apparmor/-/issues/395 Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
parent
cf5be7d356
commit
7ef7704f5a
@ -89,9 +89,9 @@ LOADED_PROFILES=$("$PARSER" -N $PROFILE_DIRS) || {
|
|||||||
echo "$LOADED_PROFILES" | awk '
|
echo "$LOADED_PROFILES" | awk '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
while (getline < "'${PROFILES}'" ) {
|
while (getline < "'${PROFILES}'" ) {
|
||||||
str = sub(/ \((enforce|complain|unconfined)\)$/, "", $0);
|
sub(/ \((enforce|complain|unconfined)\)$/, "", $0);
|
||||||
if (match($0, /^libvirt-[0-9a-f\-]+$/) == 0)
|
if (match($0, /^libvirt-[0-9a-f\-]+$/) == 0)
|
||||||
arr[$str] = $str
|
arr[$0] = $0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user