diff --git a/tests/regression/apparmor/aa_exec.sh b/tests/regression/apparmor/aa_exec.sh index 57241a72c..b65f357f5 100755 --- a/tests/regression/apparmor/aa_exec.sh +++ b/tests/regression/apparmor/aa_exec.sh @@ -31,11 +31,12 @@ genprofile_aa_exec() mode="(complain) " fi fi - genprofile --stdin < ${nstest}, } +EOF +genprofile --append image=$nstest --stdin < &${nstest}, } +EOF + genprofile --append image=$nstest --stdin < &$nstest, } +EOF +genprofile --append image=$nstest --stdin < &:nnp:unconfined, } +EOF + genprofile --append image=:nnp:$bin/open --stdin < &:nnp:$bin/open, } +EOF + genprofile --append image=:nnp:$bin/open --stdin <," >$profile - num_emitted=0 + echo "abi ," >$profile + num_emitted=0 + else + num_emmited=$(wc -l < "$profilenames") + fi while /bin/true do - imagename=$test + imagename=$testbin # image/subhat allows overriding of the default # imagename which is based on the testname @@ -457,7 +464,7 @@ fi # it is most often used after --, in fact it is basically # mandatory after -- case "$1" in - image=*) imagename=`echo $1 | sed 's/^image=\([^:]*\).*$/\1/'` + image=*) imagename=`echo $1 | sed 's/^image=\(.*\)$/\1/'` num_emitted=0 shift ;; @@ -495,9 +502,12 @@ fi break done + if [ $append == "true" ] + then + replaceprofile # if old and new profiles consist of the same entries # we can do a replace, else remove/reload - if [ $profileloaded -eq 1 ] + elif [ $profileloaded -eq 1 ] then names1=$tmpdir/sorted1 names2=$tmpdir/sorted2 @@ -507,13 +517,13 @@ fi if cmp -s $names1 $names2 then replaceprofile - else + else removeprofile ${profile}.old loadprofile fi rm -f $names1 $names2 - + else loadprofile fi @@ -622,6 +632,11 @@ settest() fatalerror "settest, illegal usage" fi + # store testbin name from testexec so that testexec represents + # what will be executed - allowing for a change of username + # with sudo -u + testbin=$testexec + if [ ! -z "$username" ] then testexec="sudo -u $username $testexec" diff --git a/tests/regression/apparmor/query_label.sh b/tests/regression/apparmor/query_label.sh index 89aa8165e..080f9b5aa 100755 --- a/tests/regression/apparmor/query_label.sh +++ b/tests/regression/apparmor/query_label.sh @@ -40,11 +40,12 @@ dbus_svc_query="session com.foo.baz" # granting anything specified in $@. genqueryprofile() { - genprofile --stdin < &$nstest, } +EOF +genprofile --append image=$nstest --stdin < &$nstest, } +EOF +genprofile --append image=$nstest --stdin <