Date: Tue, 22 Jan 2008 07:03:13 GMT From: Zhouyi ZHOU <zhouzhouyi@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 133850 for review Message-ID: <200801220703.m0M73DXK079879@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=133850 Change 133850 by zhouzhouyi@zhouzhouyi_mactest on 2008/01/22 07:03:00 Style Modification Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/fifo/00.t#3 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/fifo/00.t#3 (text+ko) ==== @@ -1,82 +1,86 @@ #!/bin/sh -# $FreeBSD: src/tools/regression/mactest/tests/fifo/00.t,v 1.2 2007/01/25 20:50:02 zhouzhouyi Exp $ +# $FreeBSD$ -desc="manipulate fifo files" +desc="MAC Framework for fifo" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..1" +case "${os}" in +FreeBSD) -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`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` + mac_test_support=`sysctl -n security.mac.test.pseudoinit 2>/dev/null` + 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 -done + for i in `sysctl security.mac | grep "\.enabled"| + sed 's/\([a-z\.]*\.enabled\)\(:\ \)\([01]\)/\1/`; do + sysctl ${i}=0 >/dev/null + done + +#enabling mactest pseudo interface + if [ -f ${mactest_conf} ]; then + rm ${mactest_conf} + fi + touch ${mactest_conf} + setfmac "mls/equal,biba/equal" ${mactest_conf} + + echo "1..5" -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/`; + n0=`namegen` + n1=`namegen` + n2=`namegen` + n3=`namegen` -############################################################# -#first make working dir, the hook checks are already done in open: - if [ -f ${mactest_conf} ]; then - rm ${mactest_conf} - fi - touch ${mactest_conf} -############################################################# - 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 ${n3} 0755 + mactestexpect "" 0 -m "mls/low(low-high)" -f ${mactest_conf} mkdir ${n3} 0755 -############################################################# #case 2: setfmac - mactestexpect "" "" -m "mls/low(low-high)" -f ${mactest_conf} system setfmac "mls/6" ${n3} + mactestexpect "" "" -m "mls/low(low-high)" -f ${mactest_conf} system setfmac "mls/6" ${n3} -############################################################# #case 3: mkfifo - 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_create:" >> ${mactest_conf} - echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf} - echo "pid = -1 mac_test_init_vnode_label" >> ${mactest_conf} - mactestexpect "" 0 -m "mls/6(low-high)" -f ${mactest_conf} mkfifo ${n3}/${n2} 0755 + 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_create:" >> ${mactest_conf} + echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf} + echo "pid = -1 vnode_init_label" >> ${mactest_conf} + mactestexpect "" 0 -m "mls/6(low-high)" -f ${mactest_conf} mkfifo ${n3}/${n2} 0755 -############################################################# #case 4: setfmac - echo -n "pid = -2 mac_test_check_vnode_relabel:" > ${mactest_conf} - echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6 biba/,mls/7" >> ${mactest_conf} - echo -n "pid = -2 mac_test_setlabel_vnode_extattr:" >> ${mactest_conf} - echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6 biba/,mls/7" >> ${mactest_conf} - echo -n "pid = -2 mac_test_relabel_vnode:" >> ${mactest_conf} - echo "biba/high(low-high),mls/6(low-high) * biba/,mls/7" >> ${mactest_conf} - mactestexpect "" "" -m "mls/6(low-high)" -f ${mactest_conf} system setfmac "mls/7" ${n3}/${n2} + echo -n "pid = -2 vnode_check_relabel:" > ${mactest_conf} + echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6 biba/,mls/7" >> ${mactest_conf} + echo -n "pid = -2 vnode_setlabel_extattr:" >> ${mactest_conf} + echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6 biba/,mls/7" >> ${mactest_conf} + echo -n "pid = -2 vnode_relabel:" >> ${mactest_conf} + echo "biba/high(low-high),mls/6(low-high) * biba/,mls/7" >> ${mactest_conf} + mactestexpect "" "" -m "mls/6(low-high)" -f ${mactest_conf} system setfmac "mls/7" ${n3}/${n2} #case 5: fifo io, it is strange that fifo io is only checked via open - echo -n "pid = -2 mac_test_check_vnode_open#VWRITE:" > ${mactest_conf} - echo "biba/high(low-high),mls/6(low-high) biba/high,mls/7" >> ${mactest_conf} - echo -n "pid = -2 mac_test_check_vnode_open#VREAD:" >> ${mactest_conf} - echo "biba/high(low-high),mls/7(low-high) biba/high,mls/7" >> ${mactest_conf} - bizarretestexpect ${fifo_io} "" "" -r "mls/7(low-high)" -w "mls/6(low-high)" -f ${mactest_conf} -p ${n3}/${n2} + echo -n "pid = -2 vnode_check_open#VWRITE:" > ${mactest_conf} + echo "biba/high(low-high),mls/6(low-high) biba/high,mls/7" >> ${mactest_conf} + echo -n "pid = -2 vnode_check_open#VREAD:" >> ${mactest_conf} + echo "biba/high(low-high),mls/7(low-high) biba/high,mls/7" >> ${mactest_conf} + bizarretestexpect ${fifo_io} "" "" -r "mls/7(low-high)" -w "mls/6(low-high)" -f ${mactest_conf} -p ${n3}/${n2} + #cleanup: - t=`sysctl security.mac.mls.enabled=0` - echo "disabling mac/mls!" - rm -fr ${n3} + sysctl security.mac.mls.enabled=0 >/dev/null + sysctl security.mac.biba.enabled=0 > /dev/null + rm ${mactest_conf} + rm -fr ${n3} +#mac_mls mac_biba and mac_test support + fi + ;; +*) + quick_exit + ;; +esac - rm ${mactest_conf} -fi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801220703.m0M73DXK079879>