From owner-p4-projects@FreeBSD.ORG Tue Jul 17 06:34:06 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F3B9416A403; Tue, 17 Jul 2007 06:34:05 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF9C516A407 for ; Tue, 17 Jul 2007 06:34:05 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 9DA7113C4BF for ; Tue, 17 Jul 2007 06:34:05 +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 l6H6Y5pJ033406 for ; Tue, 17 Jul 2007 06:34:05 GMT (envelope-from zhouzhouyi@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l6H6Y5Ub033402 for perforce@freebsd.org; Tue, 17 Jul 2007 06:34:05 GMT (envelope-from zhouzhouyi@FreeBSD.org) Date: Tue, 17 Jul 2007 06:34:05 GMT Message-Id: <200707170634.l6H6Y5Ub033402@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 123623 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: Tue, 17 Jul 2007 06:34:06 -0000 http://perforce.freebsd.org/chv.cgi?CH=123623 Change 123623 by zhouzhouyi@zhouzhouyi_mactest on 2007/07/17 06:33:44 Correct the error report mechanism for mactest Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#9 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/misc.sh#8 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/open/02.t#2 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#9 (text+ko) ==== @@ -531,9 +531,10 @@ const char *serrno; serrno = err2str(errno); - fprintf(stderr, "%s returned %d\n", scall->sd_name, rval); + printf("%s returned %d\n", scall->sd_name, rval); printf("%s\n", serrno); - exit(1); + return (i); + // exit(1); } printf("0\n"); return (i); @@ -763,7 +764,7 @@ record_from_conf = record_from_conf->next; else{ notgood = 1; - fprintf(stderr, "\n missing ...\n"); + fprintf(stderr, "missing ...\n"); struct modes_or_flags *iterator1, *tmp1; struct labelstrings *iterator2, *tmp2; fprintf(stderr, "pid = %d ", record_from_conf->pid); ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/misc.sh#8 (text+ko) ==== @@ -4,8 +4,10 @@ pid=0 pid_file="`pwd`/pidfile" tmp_file="`pwd`/tmp" +tmp_file1="`pwd`/tmp1" mactest_conf="`pwd`/mactest.conf" + echo ${dir} | egrep '^/' >/dev/null 2>&1 if [ $? -eq 0 ]; then maindir="${dir}/../.." @@ -43,17 +45,42 @@ { e="${1}" shift - ${mactest} $* 2>/dev/null 1>>${tmp_file} + + if [ -f ${tmp_file} ]; then + rm ${tmp_file} + fi + touch ${tmp_file} + + if [ -f ${tmp_file1} ]; then + rm ${tmp_file1} + fi + touch ${tmp_file1} + +#set equal label to above files + label=`getfmac "."| sed 's/\(\.:\ \)\([a-z\,\/]*\)/\2/` + label1=`echo ${label}|sed 's/\/[a-z:0-9\+]*/\/equal/g` + setfmac ${label1} ${tmp_file} ${tmp_file1} /var/log/mactest + + ${mactest} $* 2>${tmp_file1} 1>>${tmp_file} r=`cat ${tmp_file}|tail -1` + s=`cat ${tmp_file1}` echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1 - if [ $? -eq 0 ] && [ ${#r} -eq ${#e} ]; then + if [ $? -eq 0 ] && [ ${#r} -eq ${#e} ] && [ ${#s} -eq 0 ]; then echo "ok ${ntest}" else + if [ ${#s} != 0 ]; then + echo ${s} + fi + + if [ $? != 0 ] || [ ${#r} != ${#e} ]; then echo ${r} + fi echo "not ok ${ntest}" fi ntest=`expr $ntest + 1` rm ${tmp_file} + rm ${tmp_file1} + } maclabelexpect() ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/open/02.t#2 (text+ko) ==== @@ -9,7 +9,7 @@ dir=`dirname $0` . ${dir}/../misc.sh -echo "1..5" +echo "1..4" n0=`namegen` n1=`namegen` @@ -25,18 +25,11 @@ #object's effective mls level, a ESRCH is returned when signaling if [ "${mac_mls_support}" != "" ] ; then - if [ -f ${tmp_file} ]; then - rm ${tmp_file} - fi - touch ${tmp_file} - setfmac mls/equal ${tmp_file} - - dvplabel=`getfmac "."| sed 's/\(\.:\ \)\([a-z\,\/]*\)/\2/` #examine the label of its parent directory echo -n "pid = -1 mac_test_check_vnode_lookup:" > ${mactest_conf} - echo "biba/high(low-high),mls/10(low-high) ${devplabel}" >> ${mactest_conf} + echo "biba/high(low-high),mls/10(low-high) ${dvplabel}" >> ${mactest_conf} #check the label of its parent directory echo -n "pid = -1 mac_test_check_vnode_create:" >> ${mactest_conf} @@ -44,7 +37,7 @@ #since the mac_mls forbid the vnode create, there are no vnode label initialization #and vnode extattr creating. - setfmac "mls/equal" /var/log/mactest + t=`sysctl security.mac.mls.enabled=1` echo "enforcing mac/mls!" @@ -59,11 +52,12 @@ #BLP: no read high echo -n "pid = -1 mac_test_check_vnode_open#VREAD:" > ${mactest_conf} - echo "biba/high(low-high),mls/10(low-high) biba/high,mls/10" >> ${mactest_conf} + echo "biba/high(low-high),mls/low(low-high) biba/high,mls/10" >> ${mactest_conf} mactestexpect EACCES -m ${dvplabel} -f ${mactest_conf} open ${n1} O_RDONLY t=`sysctl security.mac.mls.enabled=0` echo "disabling mac/mls!" +#BLP: ok read low #cleanup: # cd .. rm -fr ${n1}