From owner-p4-projects@FreeBSD.ORG Mon Jan 21 07:13:24 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A08E416A421; Mon, 21 Jan 2008 07:13:24 +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 199E716A417 for ; Mon, 21 Jan 2008 07:13:24 +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 012EE13C442 for ; Mon, 21 Jan 2008 07:13:24 +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 m0L7DNfX084591 for ; Mon, 21 Jan 2008 07:13:23 GMT (envelope-from zhouzhouyi@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0L7DNpA084588 for perforce@freebsd.org; Mon, 21 Jan 2008 07:13:23 GMT (envelope-from zhouzhouyi@FreeBSD.org) Date: Mon, 21 Jan 2008 07:13:23 GMT Message-Id: <200801210713.m0L7DNpA084588@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 133762 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: Mon, 21 Jan 2008 07:13:25 -0000 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 ;;