Date: Fri, 4 Jan 2008 07:50:21 GMT From: Zhouyi ZHOU <zhouzhouyi@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 132464 for review Message-ID: <200801040750.m047oLJK051529@repoman.freebsd.org>
index | next in thread | raw e-mail
http://perforce.freebsd.org/chv.cgi?CH=132464 Change 132464 by zhouzhouyi@zhouzhouyi_mactest on 2008/01/04 07:50:02 style modification Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/truncate/00.t#2 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/truncate/00.t#2 (text+ko) ==== @@ -1,95 +1,97 @@ #!/bin/sh -# $FreeBSD: src/tools/regression/mactest/tests/truncate/00.t,v 1.2 2007/01/25 20:50:02 zhouzhouyi Exp $ +# $FreeBSD$ desc="truncate descrease/increase file size" - dir=`dirname $0` . ${dir}/../misc.sh -echo "1..9" +case "${os}" in +FreeBSD) -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` + 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 >/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..9" -mac_mls_support=`sysctl -n security.mac.mls.enabled 2>/dev/null` -mac_biba_support=`sysctl -n security.mac.biba.enabled 2>/dev/null` + n0=`namegen` + n1=`namegen` -if [ "${mac_mls_support}" != "" ] && [ "${mac_biba_support}" != "" ] ; then - dvplabel=`getfmac ".."| sed 's/\(\.\.:\ \)\([a-z\,\/]*\)/\2/`; + dvplabel=`getfmac ".."| sed 's/\(\.\.:\ \)\([a-z\,\/]*\)/\2/`; + 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 + sysctl security.mac.biba.revocation_enabled=1 > /dev/null - 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.biba.enabled=1` - echo "enforcing mac/biba!" - t=`sysctl security.mac.mls.revocation_enabled=1` - t=`sysctl security.mac.biba.revocation_enabled=1` - echo "enable revocation!" ############################################################# #case 1-2 #first make working dir, the hook checks are already done in open: - mactestexpect "" 0 -m "mls/low(low-high)" -f ${mactest_conf} mkdir ${n1} 0755 - mactestexpect "" "" -m "mls/low(low-high)" -f ${mactest_conf} system setfmac "mls/6" ${n1} + mactestexpect "" 0 -m "mls/low(low-high)" -f ${mactest_conf} mkdir ${n1} 0755 + mactestexpect "" "" -m "mls/low(low-high)" -f ${mactest_conf} system setfmac "mls/6" ${n1} ############################################################# #case 3-4 #create the node - mactestexpect "" 0 -m "mls/6(low-high)" -f ${mactest_conf} create ${n1}/${n0} 0644 - mactestexpect "" "" -m "mls/6(low-high)" -f ${mactest_conf} system setfmac "mls/7" ${n1}/${n0} + mactestexpect "" 0 -m "mls/6(low-high)" -f ${mactest_conf} create ${n1}/${n0} 0644 + mactestexpect "" "" -m "mls/6(low-high)" -f ${mactest_conf} system setfmac "mls/7" ${n1}/${n0} ############################################################# #case 5: do the truncate operation, blp no write down - echo -n "pid = -1 mac_test_check_vnode_lookup:" > ${mactest_conf} - echo "biba/high(low-high),mls/9(low-high) biba/high,mls/6" >> ${mactest_conf} - echo -n "pid = -1 mac_test_check_vnode_write:" >> ${mactest_conf} - echo "biba/high(low-high),mls/9(low-high) NULL biba/high,mls/7" >> ${mactest_conf} - mactestexpect "" EACCES -m "mls/9(low-high)" -f ${mactest_conf} truncate ${n1}/${n0} 1234567 + echo -n "pid = -1 vnode_check_lookup:" > ${mactest_conf} + echo "biba/high(low-high),mls/9(low-high) biba/high,mls/6" >> ${mactest_conf} + echo -n "pid = -1 vnode_check_write:" >> ${mactest_conf} + echo "biba/high(low-high),mls/9(low-high) biba/high,mls/7" >> ${mactest_conf} + mactestexpect "" EACCES -m "mls/9(low-high)" -f ${mactest_conf} truncate ${n1}/${n0} 1234567 #case 6: do the truncate operation, biba no write down - echo -n "pid = -1 mac_test_check_vnode_lookup:" > ${mactest_conf} - echo "biba/low(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf} - echo -n "pid = -1 mac_test_check_vnode_write:" >> ${mactest_conf} - echo "biba/low(low-high),mls/6(low-high) NULL biba/high,mls/7" >> ${mactest_conf} - mactestexpect "" EACCES -m "mls/6(low-high),biba/low(low-high)" -f ${mactest_conf} truncate ${n1}/${n0} 1234567 + echo -n "pid = -1 vnode_check_lookup:" > ${mactest_conf} + echo "biba/low(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf} + echo -n "pid = -1 vnode_check_write:" >> ${mactest_conf} + echo "biba/low(low-high),mls/6(low-high) biba/high,mls/7" >> ${mactest_conf} + mactestexpect "" EACCES -m "mls/6(low-high),biba/low(low-high)" -f ${mactest_conf} truncate ${n1}/${n0} 1234567 #case 7: succussfully truncate - rm ${mactest_conf} - touch ${mactest_conf} - mactestexpect "" 0 -m "mls/6(low-high),biba/high(low-high)" -f ${mactest_conf} truncate ${n1}/${n0} 1234567 + truncate -s 0 ${mactest_conf} + mactestexpect "" 0 -m "mls/6(low-high),biba/high(low-high)" -f ${mactest_conf} truncate ${n1}/${n0} 1234567 #case 8: lstat the file size, blp no read up - echo -n "pid = -1 mac_test_check_vnode_stat:" > ${mactest_conf} - echo "biba/high(low-high),mls/6(low-high) NULL biba/high,mls/7" >> ${mactest_conf} - mactestexpect "" EACCES -m "mls/6(low-high)" -f ${mactest_conf} lstat ${n1}/${n0} size + echo -n "pid = -1 vnode_check_stat:" > ${mactest_conf} + echo "biba/high(low-high),mls/6(low-high) biba/high,mls/7" >> ${mactest_conf} + mactestexpect "" EACCES -m "mls/6(low-high)" -f ${mactest_conf} lstat ${n1}/${n0} size #case 9: successfully lstat the file size - rm ${mactest_conf} - touch ${mactest_conf} - mactestexpect "" 1234567 -m "mls/7(low-high)" -f ${mactest_conf} lstat ${n1}/${n0} size + truncate -s 0 ${mactest_conf} + mactestexpect "" 1234567 -m "mls/7(low-high)" -f ${mactest_conf} lstat ${n1}/${n0} size #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 ${n1} - 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 + ;; +esachelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801040750.m047oLJK051529>
