summaryrefslogtreecommitdiffstats
path: root/recipes-mac/smack/smack-test/smack_test_file_access.sh
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-mac/smack/smack-test/smack_test_file_access.sh')
-rw-r--r--recipes-mac/smack/smack-test/smack_test_file_access.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/recipes-mac/smack/smack-test/smack_test_file_access.sh b/recipes-mac/smack/smack-test/smack_test_file_access.sh
index 5a0ce84..598f1df 100644
--- a/recipes-mac/smack/smack-test/smack_test_file_access.sh
+++ b/recipes-mac/smack/smack-test/smack_test_file_access.sh
@@ -8,7 +8,7 @@ CAT=`which cat`
8ECHO=`which echo` 8ECHO=`which echo`
9uid=1000 9uid=1000
10initial_label=`cat /proc/self/attr/current` 10initial_label=`cat /proc/self/attr/current`
11python $TMP/notroot.py $uid "TheOther" $ECHO 'TEST' > $test_file 11python3 $TMP/notroot.py $uid "TheOther" $ECHO 'TEST' > $test_file
12chsmack -a "TheOther" $test_file 12chsmack -a "TheOther" $test_file
13 13
14# 12345678901234567890123456789012345678901234567890123456 14# 12345678901234567890123456789012345678901234567890123456
@@ -17,7 +17,7 @@ rule_ro="TheOne TheOther r----"
17 17
18# Remove pre-existent rules for "TheOne TheOther <access>" 18# Remove pre-existent rules for "TheOne TheOther <access>"
19echo -n "$delrule" > $SMACK_PATH/load 19echo -n "$delrule" > $SMACK_PATH/load
20python $TMP/notroot.py $uid "TheOne" $CAT $test_file 2>&1 1>/dev/null | grep -q "Permission denied" || RC=$? 20python3 $TMP/notroot.py $uid "TheOne" $CAT $test_file 2>&1 1>/dev/null | grep -q "Permission denied" || RC=$?
21if [ $RC -ne 0 ]; then 21if [ $RC -ne 0 ]; then
22 echo "Process with different label than the test file and no read access on it can read it" 22 echo "Process with different label than the test file and no read access on it can read it"
23 exit $RC 23 exit $RC
@@ -25,7 +25,7 @@ fi
25 25
26# adding read access 26# adding read access
27echo -n "$rule_ro" > $SMACK_PATH/load 27echo -n "$rule_ro" > $SMACK_PATH/load
28python $TMP/notroot.py $uid "TheOne" $CAT $test_file | grep -q "TEST" || RC=$? 28python3 $TMP/notroot.py $uid "TheOne" $CAT $test_file | grep -q "TEST" || RC=$?
29if [ $RC -ne 0 ]; then 29if [ $RC -ne 0 ]; then
30 echo "Process with different label than the test file but with read access on it cannot read it" 30 echo "Process with different label than the test file but with read access on it cannot read it"
31 exit $RC 31 exit $RC
@@ -36,7 +36,7 @@ echo -n "$delrule" > $SMACK_PATH/load
36# changing label of test file to * 36# changing label of test file to *
37# according to SMACK documentation, read access on a * object is always permitted 37# according to SMACK documentation, read access on a * object is always permitted
38chsmack -a '*' $test_file 38chsmack -a '*' $test_file
39python $TMP/notroot.py $uid "TheOne" $CAT $test_file | grep -q "TEST" || RC=$? 39python3 $TMP/notroot.py $uid "TheOne" $CAT $test_file | grep -q "TEST" || RC=$?
40if [ $RC -ne 0 ]; then 40if [ $RC -ne 0 ]; then
41 echo "Process cannot read file with * label" 41 echo "Process cannot read file with * label"
42 exit $RC 42 exit $RC
@@ -45,7 +45,7 @@ fi
45# changing subject label to * 45# changing subject label to *
46# according to SMACK documentation, every access requested by a star labeled subject is rejected 46# according to SMACK documentation, every access requested by a star labeled subject is rejected
47TOUCH=`which touch` 47TOUCH=`which touch`
48python $TMP/notroot.py $uid '*' $TOUCH $TMP/test_file_2 48python3 $TMP/notroot.py $uid '*' $TOUCH $TMP/test_file_2
49ls -la $TMP/test_file_2 2>&1 | grep -q 'No such file or directory' || RC=$? 49ls -la $TMP/test_file_2 2>&1 | grep -q 'No such file or directory' || RC=$?
50if [ $RC -ne 0 ];then 50if [ $RC -ne 0 ];then
51 echo "Process with label '*' should not have any access" 51 echo "Process with label '*' should not have any access"