Date: Mon, 21 Jan 2008 07:13:23 GMT From: Zhouyi ZHOU <zhouzhouyi@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 133762 for review Message-ID: <200801210713.m0L7DNpA084588@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=133762 Change 133762 by zhouzhouyi@zhouzhouyi_mactest on 2008/01/21 07:12:51 Style Modification Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/mount/00.t#2 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/mount/00.t#2 (text+ko) ==== @@ -1,5 +1,5 @@ #!/bin/sh -# $FreeBSD: src/tools/regression/mactest/tests/mount/00.t,v 1.2 2007/01/25 20:50:02 zhouzhouyi Exp $ +# $FreeBSD$ desc="Testing mount stat" @@ -13,88 +13,84 @@ #turn off all the switches for i in `sysctl security.mac | grep "\.enabled"| sed 's/\([a-z\.]*\.enabled\)\(:\ \)\([01]\)/\1/`; do - sysctl ${i}=0 + sysctl ${i}=0 > /dev/null done - echo "1..12" - n0=`namegenshort` - n1=`namegen` - n2=`namegenshort` - 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/`; -############################################################# -#first make working dir, the hook checks are already done in open: - if [ -f ${mactest_conf} ]; then - rm ${mactest_conf} - fi - touch ${mactest_conf} + + if [ -f ${mactest_conf} ]; then + rm ${mactest_conf} + fi + touch ${mactest_conf} + setfmac "mls/equal,biba/equal" ${mactest_conf} + + echo "1..13" + + + n0=`namegenshort` + n1=`namegen` + n2=`namegenshort` + + sysctl security.mac.mls.enabled=1 > /dev/null + sysctl security.mac.biba.enabled=1 > /dev/null -############################################################# - t=`sysctl security.mac.mls.enabled=1` - echo "enforcing mac/mls!" - t=`sysctl security.mac.biba.enabled=1` - echo "enforcing mac/biba!" #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: mdconfig, couldn't open /dev/mdctl, BLP prevents write down - mactestexpect "*Permission.denied" "" -m "mls/7(low-high)" -f ${mactest_conf} system mdconfig -a -n -t malloc -s 1m + mactestexpect "*Permission.denied" "" -m "mls/7(low-high)" -f ${mactest_conf} system mdconfig -a -n -t malloc -s 1m #case 3: mdconfig, successfully open /dev/mdctl - mactestexpect "" "*" -m "mls/low(low-high)" -f ${mactest_conf} system mdconfig -a -n -t malloc -s 1m - mdnum=${ret} + mactestexpect "" "*" -m "mls/low(low-high)" -f ${mactest_conf} system mdconfig -a -n -t malloc -s 1m + mdnum=${ret} #case 4: newfs, fail for writing, BLP prevents write down - mactestexpect "*failed.to.open.disk.for.writing" "*" -m "mls/7(low-high)" -f ${mactest_conf} system newfs -i 1 /dev/md${mdnum} + mactestexpect "*failed.to.open.disk.for.writing" "*" -m "mls/7(low-high)" -f ${mactest_conf} system newfs -i 1 /dev/md${mdnum} #case 5: newfs, success - mactestexpect "" "*" -m "mls/low(low-high)" -f ${mactest_conf} system newfs -i 1 /dev/md${mdnum} + mactestexpect "" "*" -m "mls/low(low-high)" -f ${mactest_conf} system newfs -i 1 /dev/md${mdnum} #case 6: mount - rm ${mactest_conf} - touch ${mactest_conf} - mactestexpect "" "" -m "mls/7(low-high)" -f ${mactest_conf} system mount /dev/md${mdnum} ${n0} + mactestexpect "" "" -m "mls/7(low-high)" -f ${mactest_conf} system mount /dev/md${mdnum} ${n0} #case 7: check mountstat not ok - echo -n "pid = -2 mac_test_check_mount_stat:" > ${mactest_conf} - echo "biba/high(low-high),mls/low(low-high) biba/high,mls/7" >> ${mactest_conf} - mactestexpect "" "*dev*" -m "mls/low(low-high)" -f ${mactest_conf} system df + echo -n "pid = -2 mount_check_stat:" > ${mactest_conf} + echo "biba/high(low-high),mls/low(low-high) biba/high,mls/7" >> ${mactest_conf} + mactestexpect "" "*dev*" -m "mls/low(low-high)" -f ${mactest_conf} system df #case 8: check mountstat ok - truncate -s 0 ${mactest_conf} - mactestexpect "" "*${n0}" -m "mls/7(low-high)" -f ${mactest_conf} system df + truncate -s 0 ${mactest_conf} + mactestexpect "" "*${n0}" -m "mls/7(low-high)" -f ${mactest_conf} system df #case 9: umount - mactestexpect "" "" -m "mls/7(low-high)" -f ${mactest_conf} system umount ${n0} + mactestexpect "" "" -m "mls/7(low-high)" -f ${mactest_conf} system umount ${n0} #case 10: remount with low label - mkdir ${n2} - mactestexpect "" "" -m "biba/7(low-high),mls/low(low-high)" -f ${mactest_conf} system mount /dev/md${mdnum} ${n2} + mkdir ${n2} + mactestexpect "" "" -m "biba/7(low-high),mls/low(low-high)" -f ${mactest_conf} system mount /dev/md${mdnum} ${n2} #case 11: check mountstat not ok - mactestexpect "" "*dev*" -m "biba/8(low-high),mls/low(low-high)" -f ${mactest_conf} system df + mactestexpect "" "*dev*" -m "biba/8(low-high),mls/low(low-high)" -f ${mactest_conf} system df #case 12: unmount - mactestexpect "" "" -m "biba/low(low-high),mls/low(low-high)" -f ${mactest_conf} system umount ${n2} + mactestexpect "" "" -m "biba/low(low-high),mls/low(low-high)" -f ${mactest_conf} system umount ${n2} #case 13: detach - mactestexpect "" "*" -m "mls/low(low-high)" -f ${mactest_conf} system mdconfig -d -u ${mdnum} + mactestexpect "" "*" -m "mls/low(low-high)" -f ${mactest_conf} system mdconfig -d -u ${mdnum} #cleanup: - t=`sysctl security.mac.mls.enabled=0` - echo "disabling mac/mls!" - t=`sysctl security.mac.biba.enabled=0` - echo "disabling mac/biba!" - rm -fr ${n0} - rm -fr ${n2} - rm ${mactest_conf} + sysctl security.mac.mls.enabled=0 > /dev/null + sysctl security.mac.biba.enabled=0 > /dev/null + rm -fr ${n0} + rm -fr ${n2} + rm ${mactest_conf} fi ;;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801210713.m0L7DNpA084588>