parser: add mount path slash filtering equality tests

Test to ensure that slash filtering occurs properly in mount path
components.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/607
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Steve Beattie 2020-09-25 23:48:27 -07:00 committed by John Johansen
parent 80d7e33432
commit 51aedb2118

View file

@ -595,6 +595,17 @@ verify_binary_equality "unix rules addr conditional" \
"@{HOME}=/a/
/t { unix bind addr=@/@{HOME}/bar, }"
# verify slash filtering for mount rules
verify_binary_equality "mount rules slash filtering" \
"/t { mount /dev/foo -> /mnt/bar, }" \
"/t { mount ///dev/foo -> /mnt/bar, }" \
"/t { mount /dev/foo -> /mnt//bar, }" \
"/t { mount /dev///foo -> ////mnt/bar, }" \
"@{MNT}=/mnt/
/t { mount /dev///foo -> @{MNT}/bar, }" \
"@{FOO}=/foo
/t { mount /dev//@{FOO} -> /mnt/bar, }"
if [ $fails -ne 0 ] || [ $errors -ne 0 ]
then
printf "ERRORS: %d\nFAILS: %d\n" $errors $fails 2>&1