From owner-p4-projects@FreeBSD.ORG Fri Jan 4 07:50:22 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1C1FF16A420; Fri, 4 Jan 2008 07:50:22 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5F4F16A419 for ; Fri, 4 Jan 2008 07:50:21 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C5A5B13C45B for ; Fri, 4 Jan 2008 07:50:21 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m047oLAV051532 for ; Fri, 4 Jan 2008 07:50:21 GMT (envelope-from zhouzhouyi@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m047oLJK051529 for perforce@freebsd.org; Fri, 4 Jan 2008 07:50:21 GMT (envelope-from zhouzhouyi@FreeBSD.org) Date: Fri, 4 Jan 2008 07:50:21 GMT Message-Id: <200801040750.m047oLJK051529@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zhouzhouyi@FreeBSD.org using -f From: Zhouyi ZHOU To: Perforce Change Reviews Cc: Subject: PERFORCE change 132464 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 07:50:22 -0000 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 + ;; +esac