Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jan 2008 06:41:24 GMT
From:      Zhouyi ZHOU <zhouzhouyi@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 132778 for review
Message-ID:  <200801080641.m086fO0P099331@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132778

Change 132778 by zhouzhouyi@zhouzhouyi_mactest on 2008/01/08 06:40:32

	style modification

Affected files ...

.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/rmdir/00.t#2 edit

Differences ...

==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/rmdir/00.t#2 (text+ko) ====

@@ -1,72 +1,81 @@
 #!/bin/sh
-# $FreeBSD: src/tools/regression/mactest/tests/symlink/00.t,v 1.2 2007/01/25 20:50:02 zhouzhouyi Exp $
+# $FreeBSD$
 
-desc="symlink creates symbolic links"
+desc="test MAC hooks for rmdir"
 
 
 dir=`dirname $0`
 . ${dir}/../misc.sh
 
-echo "1..5"
+case "${os}" in
+FreeBSD)
+
+	mac_mls_support=`sysctl -n security.mac.mls.enabled 2>/dev/null`
+	mac_biba_support=`sysctl -n security.mac.biba.enabled 2>/dev/null`
+	mac_test_support=`sysctl -n security.mac.test.pseudoinit 2>/dev/null`
 
-n0=`namegen`
-n1=`namegen`
+	if [ "${mac_mls_support}" != "" ] && [ "${mac_biba_support}" != "" ] &&
+	    [ "${mac_test_support}" != "" ]; then
 
+#turn off all the switches
+		for i in `sysctl security.mac | grep "\.enabled"| 
+			sed 's/\([a-z\.]*\.enabled\)\(:\ \)\([01]\)/\1/`; do
+			sysctl ${i}=0 >/dev/null
+		done
 
 
-#turn off all the switches
-for i in `sysctl security.mac | grep "\.enabled"| 
-     sed 's/\([a-z\.]*\.enabled\)\(:\ \)\([01]\)/\1/`; do
-sysctl ${i}=0
-done
+		if [ -f ${mactest_conf} ]; then
+			rm ${mactest_conf}
+		fi
+		touch ${mactest_conf}
+		setfmac "mls/equal,biba/equal" ${mactest_conf}
+		
+
+		echo "1..5"
+
+		n0=`namegen`
+		n1=`namegen`
 
-mac_mls_support=`sysctl -n security.mac.mls.enabled 2>/dev/null`
-mac_biba_support=`sysctl -n security.mac.biba.enabled 2>/dev/null`
 
-if [ "${mac_mls_support}" != "" ] && [ "${mac_biba_support}" != "" ] ; then
-    dvplabel=`getfmac ".."| sed 's/\(\.\.:\ \)\([a-z\,\/]*\)/\2/`; 
+		dvplabel=`getfmac ".."| sed 's/\(\.\.:\ \)\([a-z\,\/]*\)/\2/`; 
 
-#############################################################
-#first make working dir, the hook checks are already done in open: 
-    if [ -f ${mactest_conf} ]; then
-	rm ${mactest_conf}
-    fi
-    touch ${mactest_conf}
+		sysctl security.mac.mls.enabled=1 > /dev/null
+		sysctl security.mac.biba.enabled=1 > /dev/null
+		sysctl security.mac.mls.revocation_enabled=1 > /dev/null
 
-#############################################################
-    t=`sysctl security.mac.mls.enabled=1`
-    echo "enforcing mac/mls!"
-    t=`sysctl security.mac.mls.revocation_enabled=1`
-    echo "enabling revoking"
 #case 1: mkdir
-    mactestexpect ""  0  -m "mls/low(low-high)"  -f ${mactest_conf} mkdir ${n0}  0755
+		mactestexpect ""  0  -m "mls/low(low-high)"  -f ${mactest_conf} mkdir ${n0}  0755
 
 #############################################################
 #case 2: setfmac
-    mactestexpect ""  "" -m "mls/low(low-high)" -f ${mactest_conf} system setfmac  "mls/6" ${n0}
+		mactestexpect ""  "" -m "mls/low(low-high)" -f ${mactest_conf} system setfmac  "mls/6" ${n0}
 
 #############################################################
 #case 3: mkdir
-    mactestexpect "" 0 -m "mls/6(low-high)" -f ${mactest_conf} mkdir ${n0}/${n1} 0644
+		mactestexpect "" 0 -m "mls/6(low-high)" -f ${mactest_conf} mkdir ${n0}/${n1} 0644
 
 #############################################################
 #case 4: setfmac
-    mactestexpect "" "" -m "mls/6(low-high)" -f ${mactest_conf} system setfmac "mls/7" ${n0}/${n1}
+		mactestexpect "" "" -m "mls/6(low-high)" -f ${mactest_conf} system setfmac "mls/7" ${n0}/${n1}
 
 #############################################################
 #case 5: rmdir
-    echo -n "pid = -1 mac_test_check_vnode_lookup:" > ${mactest_conf}
-    echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf}
-    echo -n "pid = -1 mac_test_check_vnode_delete:" >> ${mactest_conf}
-    echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6 biba/high,mls/7" >> ${mactest_conf}
-    mactestexpect "" 0 -m "mls/6(low-high)" -f ${mactest_conf} rmdir ${n0}/${n1}
-
+		echo -n "pid = -1 vnode_check_lookup:" > ${mactest_conf}
+		echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf}
+		echo -n "pid = -1 vnode_check_unlink:" >> ${mactest_conf}
+		echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6 biba/high,mls/7" >> ${mactest_conf}
+		echo "pid = -2 vnode_destroy_label" >> ${mactest_conf}
+		mactestexpect "" 0 -m "mls/6(low-high)" -f ${mactest_conf} rmdir ${n0}/${n1}
 
 #cleanup:
-    t=`sysctl security.mac.mls.enabled=0`
-    echo "disabling mac/mls!"
-    rm -fr ${n0}
-
-    rm ${mactest_conf}
-fi
-
+		sysctl security.mac.mls.enabled=0 >/dev/null
+		sysctl security.mac.biba.enabled=0 > /dev/null
+		rm -fr ${n1}
+		rm ${mactest_conf}
+#mac_mls mac_biba and mac_test support
+	fi
+	;;
+*)
+        quick_exit
+        ;;
+esac



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801080641.m086fO0P099331>