mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-29 21:38:15 +00:00
aa-decode: add the ability to support PROCTITLE string
buglink: https://bugs.launchpad.net/apparmor/+bug/1736841 Signed-off-by: John Johansen <john.johansen@canonical.com> (cherry picked from commit 3afbfed9eef56d029a9a5890e5c463165530d509)
This commit is contained in:
parent
728a622df1
commit
00d9997cdd
@ -70,7 +70,7 @@ fi
|
|||||||
while read line ; do
|
while read line ; do
|
||||||
|
|
||||||
# check if line contains encoded name= or profile=
|
# check if line contains encoded name= or profile=
|
||||||
if [[ "$line" =~ \ (name|profile)=[0-9a-fA-F] ]]; then
|
if [[ "$line" =~ \ (name|profile|proctitle)=[0-9a-fA-F] ]]; then
|
||||||
|
|
||||||
# cut the encoded filename/profile name out of the line and decode it
|
# cut the encoded filename/profile name out of the line and decode it
|
||||||
ne=`echo "$line" | sed 's/.* name=\([^ ]*\).*$/\\1/g'`
|
ne=`echo "$line" | sed 's/.* name=\([^ ]*\).*$/\\1/g'`
|
||||||
@ -79,9 +79,13 @@ while read line ; do
|
|||||||
pe=`echo "$line" | sed 's/.* profile=\([^ ]*\).*$/\\1/g'`
|
pe=`echo "$line" | sed 's/.* profile=\([^ ]*\).*$/\\1/g'`
|
||||||
pd="$(decode ${pe/\'/\\\'})"
|
pd="$(decode ${pe/\'/\\\'})"
|
||||||
|
|
||||||
|
pce=`echo "$line" | sed 's/.* proctitle=\([^ ]*\).*$/\\1/g'`
|
||||||
|
pcd="$(decode ${pce/\'/\\\'})"
|
||||||
|
|
||||||
# replace encoded name and profile with its decoded counterparts (only if it was encoded)
|
# replace encoded name and profile with its decoded counterparts (only if it was encoded)
|
||||||
test -n "$nd" && line="${line/name=$ne/name=\"$nd\"}"
|
test -n "$nd" && line="${line/name=$ne/name=\"$nd\"}"
|
||||||
test -n "$pd" && line="${line/profile=$pe/profile=\"$pd\"}"
|
test -n "$pd" && line="${line/profile=$pe/profile=\"$pd\"}"
|
||||||
|
test -n "$pcd" && line="${line/proctitle=$pce/proctitle=\"$pcd\"}"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user