2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 05:47:59 +00:00

Fixup the openat.sh test as well.

This commit is contained in:
Steve Beattie 2007-03-13 22:10:45 +00:00
parent e102bd2651
commit 94d4ac649e

View File

@ -103,3 +103,67 @@ Index: subdomain/xattrs.sh
okperm=rw
badperm=r
Index: subdomain/openat.sh
===================================================================
--- subdomain.orig/openat.sh
+++ subdomain/openat.sh
@@ -22,43 +22,44 @@ bin=$pwd
. $bin/prologue.inc
+dir=${tmpdir}/
subdir=deleteme
file=${subdir}/file
-filepath=${tmpdir}/${file}
+filepath=${dir}${file}
okperm=rw
badperm1=r
badperm2=w
-mkdir ${tmpdir}/${subdir}
+mkdir ${dir}/${subdir}
# PASS UNCONFINED
-runchecktest "OPENAT unconfined RW (create) " pass $tmpdir $file
+runchecktest "OPENAT unconfined RW (create) " pass $dir $file
# PASS TEST (the file shouldn't exist, so open should create it
rm -f ${filepath}
-genprofile ${tmpdir}:r ${filepath}:$okperm
-runchecktest "OPENAT RW (create) " pass $tmpdir $file
+genprofile ${dir}:r ${filepath}:$okperm
+runchecktest "OPENAT RW (create) " pass $dir $file
# PASS TEST
-genprofile ${tmpdir}:r ${filepath}:$okperm
-runchecktest "OPENAT RW" pass $tmpdir $file
+genprofile ${dir}:r ${filepath}:$okperm
+runchecktest "OPENAT RW" pass $dir $file
# FAILURE TEST (1)
-genprofile ${tmpdir}:r ${filepath}:$badperm1
-runchecktest "OPENAT R" fail $tmpdir $file
+genprofile ${dir}:r ${filepath}:$badperm1
+runchecktest "OPENAT R" fail $dir $file
# FAILURE TEST (2)
-genprofile ${tmpdir}:r ${filepath}:$badperm2
-runchecktest "OPENAT W" fail $tmpdir $file
+genprofile ${dir}:r ${filepath}:$badperm2
+runchecktest "OPENAT W" fail $dir $file
# FAILURE TEST (3)
-genprofile ${tmpdir}:r ${filepath}:$badperm1 cap:dac_override
-runchecktest "OPENAT R+dac_override" fail $tmpdir $file
+genprofile ${dir}:r ${filepath}:$badperm1 cap:dac_override
+runchecktest "OPENAT R+dac_override" fail $dir $file
# FAILURE TEST (4)
# This is testing for bug: https://bugs.wirex.com/show_bug.cgi?id=2885
# When we open O_CREAT|O_RDWR, we are (were?) allowing only write access
# to be required.
rm -f ${filepath}
-genprofile ${tmpdir}:r ${filepath}:$badperm2
-runchecktest "OPENAT W (create)" fail $tmpdir $file
+genprofile ${dir}:r ${filepath}:$badperm2
+runchecktest "OPENAT W (create)" fail $dir $file