mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 14:55:10 +00:00
Fixup the openat.sh test as well.
This commit is contained in:
@@ -103,3 +103,67 @@ Index: subdomain/xattrs.sh
|
|||||||
okperm=rw
|
okperm=rw
|
||||||
badperm=r
|
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
|
||||||
|
Reference in New Issue
Block a user