Whamcloud - gitweb
branch: HEAD
[fs/lustre-release.git] / lustre / tests / sanity-sec.sh
index 73d2830..b20c986 100644 (file)
 #!/bin/bash
 #
-# Run select tests by setting ONLY, or as arguments to the script.
+# Run select tests by setting SEC_ONLY, or as arguments to the script.
 # Skip specific tests by setting EXCEPT.
 #
-# e.g. ONLY="22 23" or ONLY="`seq 32 39`" or EXCEPT="31"
+
 set -e
 
-ONLY=${ONLY:-"$*"}
+SRCDIR=`dirname $0`
+export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
+
+SEC_ONLY=${SEC_ONLY:-"$*"}
 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
-[ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
-
-SRCDIR=`dirname $0`
-export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
-export SECURITY=${SECURITY:-"null"}
+[ "$ALWAYS_EXCEPT$EXCEPT" ] && \
+       echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT`"
 
 TMP=${TMP:-/tmp}
-FSTYPE=${FSTYPE:-ext3}
-
-CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
-CREATETEST=${CREATETEST:-createtest}
 LFS=${LFS:-lfs}
-LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
-LFIND=${LFIND:-"$LFS find"}
-LVERIFY=${LVERIFY:-ll_dirstripe_verify}
 LCTL=${LCTL:-lctl}
-MCREATE=${MCREATE:-mcreate}
-OPENFILE=${OPENFILE:-openfile}
-OPENUNLINK=${OPENUNLINK:-openunlink}
-TOEXCL=${TOEXCL:-toexcl}
-TRUNCATE=${TRUNCATE:-truncate}
-MUNLINK=${MUNLINK:-munlink}
-SOCKETSERVER=${SOCKETSERVER:-socketserver}
-SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
-IOPENTEST1=${IOPENTEST1:-iopentest1}
-IOPENTEST2=${IOPENTEST2:-iopentest2}
-
-. krb5_env.sh
-
-if [ $UID -ne 0 ]; then
-       RUNAS_ID="$UID"
-       RUNAS=""
-else
-       RUNAS_ID=${RUNAS_ID:-500}
-       RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
-fi
+RUNAS=${RUNAS:-runas}
 
-if [ `using_krb5_sec $SECURITY` == 'y' ] ; then
-    start_krb5_kdc || exit 1
-    if [ $RUNAS_ID -ne $UID ]; then
-        $RUNAS ./krb5_refresh_cache.sh || exit 2
-    fi
-fi
+log() {
+       echo "$*"
+       $LCTL mark "$*" 2> /dev/null || true
+}
 
-export NAME=${NAME:-local}
+SANITYSECLOG=${SANITYSECLOG:-/tmp/sanity-sec.log}
 
-SAVE_PWD=$PWD
+[ "$SANITYSECLOG" ] && rm -f $SANITYSECLOG || true
 
-clean() {
-       echo -n "cln.."
-       sh llmountcleanup.sh > /dev/null || exit 20
-       I_MOUNTED=no
+sec_error() { 
+       log "FAIL: $TESTNAME $@"
+       if [ "$SANITYSECLOG" ]; then
+               echo "FAIL: $TESTNAME $@" >> $SANITYSECLOG
+       else
+               exit 1
+       fi
 }
-CLEAN=${CLEAN:-clean}
 
-start() {
-       echo -n "mnt.."
-       sh llrmount.sh > /dev/null || exit 10
-       I_MOUNTED=yes
-       echo "done"
+pass() { 
+       echo PASS $@
 }
-START=${START:-start}
 
-log() {
-       echo "$*"
-       lctl mark "$*" 2> /dev/null || true
-}
+ID1=500
+ID2=501
 
-trace() {
-       log "STARTING: $*"
-       strace -o $TMP/$1.strace -ttt $*
-       RC=$?
-       log "FINISHED: $*: rc $RC"
-       return 1
-}
-TRACE=${TRACE:-""}
-
-check_kernel_version() {
-       VERSION_FILE=/proc/fs/lustre/kernel_version
-       WANT_VER=$1
-       [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
-       GOT_VER=`cat $VERSION_FILE`
-       [ $GOT_VER -ge $WANT_VER ] && return 0
-       log "test needs at least kernel version $WANT_VER, running $GOT_VER"
-       return 1
-}
+USER1=`cat /etc/passwd|grep :$ID1:$ID1:|cut -d: -f1`
+USER2=`cat /etc/passwd|grep :$ID2:$ID2:|cut -d: -f1`
 
-run_one() {
-       if ! cat /proc/mounts | grep -q $DIR; then
-               $START
-       fi
-       echo -1 >/proc/sys/portals/debug        
-       log "== test $1: $2"
+if [ ! "$USER1" ]; then
+       echo "===== Please add user1 (uid=$ID1 gid=$ID1)! Skip sanity-sec ====="
+       sec_error "===== Please add user1 (uid=$ID1 gid=$ID1)! ====="
+       exit 0
+fi
+
+if [ ! "$USER2" ]; then
+       echo "===== Please add user2 (uid=$ID2 gid=$ID2)! Skip sanity-sec ====="
+       sec_error "===== Please add user2 (uid=$ID2 gid=$ID2)! ====="
+       exit 0
+fi
+
+export NAME=${NAME:-local}
+
+LUSTRE=${LUSTRE:-`dirname $0`/..} 
+. $LUSTRE/tests/test-framework.sh
+init_test_env $@
+. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+
+if [ ! -z "$USING_KRB5" ]; then
+    $RUNAS -u $ID1 krb5_login.sh || exit 1
+    $RUNAS -u $ID2 krb5_login.sh || exit 1
+fi
+
+sec_run_one() {
+       BEFORE=`date +%s`
+       log "== test $1 $2= `date +%H:%M:%S` ($BEFORE)"
        export TESTNAME=test_$1
-       test_$1 || error "test_$1: exit with rc=$?"
+       test_$1 || sec_error "exit with rc=$?"
        unset TESTNAME
-       pass
-       cd $SAVE_PWD
-       $CLEAN
+       pass "($((`date +%s` - $BEFORE))s)"
 }
 
 build_test_filter() {
-        for O in $ONLY; do
-            eval ONLY_${O}=true
+        for O in $SEC_ONLY; do
+            eval SEC_ONLY_${O}=true
         done
         for E in $EXCEPT $ALWAYS_EXCEPT; do
             eval EXCEPT_${E}=true
@@ -121,24 +92,24 @@ build_test_filter() {
 }
 
 _basetest() {
-    echo $*
+       echo $*
 }
 
 basetest() {
-    IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
+       IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
 }
 
-run_test() {
+sec_run_test() {
          base=`basetest $1`
-         if [ "$ONLY" ]; then
-                 testname=ONLY_$1
+         if [ "$SEC_ONLY" ]; then
+                 testname=SEC_ONLY_$1
                  if [ ${!testname}x != x ]; then
-                       run_one $1 "$2"
+                       sec_run_one $1 "$2"
                        return $?
                  fi
-                 testname=ONLY_$base
+                 testname=SEC_ONLY_$base
                  if [ ${!testname}x != x ]; then
-                         run_one $1 "$2"
+                         sec_run_one $1 "$2"
                          return $?
                  fi
                  echo -n "."
@@ -154,190 +125,246 @@ run_test() {
                  echo "skipping excluded test $1 (base $base)"
                  return 0
         fi
-        run_one $1 "$2"
+        sec_run_one $1 "$2"
        return $?
 }
 
-[ "$SANITYLOG" ] && rm -f $SANITYLOG || true
-
-error() { 
-       log "FAIL: $@"
-       if [ "$SANITYLOG" ]; then
-               echo "FAIL: $TESTNAME $@" >> $SANITYLOG
-       else
-               exit 1
-       fi
-}
-
-pass() { 
-       echo PASS
+mounted_lustre_filesystems() {
+       awk '($3 ~ "lustre" && $1 ~ ":") { print $2 }' /proc/mounts
 }
 
-MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
-if [ -z "$MOUNT" ]; then
-       sh llmount.sh
-       MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
-       [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
-       I_MOUNTED=yes
+MOUNTED="`mounted_lustre_filesystems`"
+if [ -z "$MOUNTED" ]; then
+        formatall
+        setupall
+       MOUNTED="`mounted_lustre_filesystems`"
+       [ -z "$MOUNTED" ] && sec_error "NAME=$NAME not mounted"
+       S_MOUNTED=yes
 fi
 
-[ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
+[ `echo $MOUNT | wc -w` -gt 1 ] && sec_error "NAME=$NAME mounted more than once"
 
 DIR=${DIR:-$MOUNT}
-[ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
+[ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && \
+       sec_cleanup && exit 99
 
-OSTCOUNT=`cat /proc/fs/lustre/llite/fs0/lov/numobd`
-STRIPECOUNT=`cat /proc/fs/lustre/llite/fs0/lov/stripecount`
-STRIPESIZE=`cat /proc/fs/lustre/llite/fs0/lov/stripesize`
+[ `ls -l $LPROC/ldlm 2> /dev/null | grep lustre-MDT | wc -l` -gt 1 ] \
+       && echo "skip multi-MDS test" && sec_cleanup && exit 0
 
-build_test_filter
+if [ -z "`lsmod | grep mdt`" ]; then
+       LOCAL_MDT=0
+       echo "remote mdt"
+       EXCEPT="$EXCEPT 1 3"
+else
+       LOCAL_MDT=1
+       echo "local mdt"
+       EXCEPT="$EXCEPT 1 2 3"
+fi
 
-test_0() {
-       touch $DIR/f
-       $CHECKSTAT -t file $DIR/f || error
-       rm $DIR/f
-       $CHECKSTAT -a $DIR/f || error
-}
-run_test 0 "touch .../f ; rm .../f ============================="
+LPROC=/proc/fs/lustre
+ENABLE_IDENTITY=/usr/sbin/l_getidentity
+DISABLE_IDENTITY=NONE
+LUSTRE_CONF_DIR=/etc/lustre
+SETXID_CONF=$LUSTRE_CONF_DIR/setxid.conf
+SETXID_CONF_BAK=$LUSTRE_CONF_DIR/setxid.conf.bak
+
+if [ $LOCAL_MDT -eq 1 ]; then
+       MDT=$(\ls $LPROC/mdt 2> /dev/null | grep -v num_refs | tail -n 1)
+       IDENTITY_UPCALL=$LPROC/mdt/$MDT/identity_upcall
+       IDENTITY_UPCALL_BAK=`more $IDENTITY_UPCALL`
+       IDENTITY_FLUSH=$LPROC/mdt/$MDT/identity_flush
+       ROOTSQUASH_UID=$LPROC/mdt/$MDT/rootsquash_uid
+       ROOTSQUASH_GID=$LPROC/mdt/$MDT/rootsquash_gid
+       NOSQUASH_NIDS=$LPROC/mdt/$MDT/nosquash_nids
+fi
 
-mdsdevice(){
-        lctl << EOF
-        dl
-        quit
-EOF
-}
+CLIENT_TYPE=$LPROC/llite/*/client_type
+grep "local client" $CLIENT_TYPE > /dev/null 2>&1 && EXCEPT="$EXCEPT 2"
+grep "remote client" $CLIENT_TYPE > /dev/null 2>&1 && EXCEPT="$EXCEPT 1 3"
 
-mynidstr(){
-        lctl << EOF
-        network tcp
-        mynid
-        quit
-EOF
-}
+build_test_filter
 
-test_1(){
-        mdsnum=`mdsdevice|awk ' $3=="mds" {print $1}'`
-       if [ ! -z "$mdsnum" ];then
-        mynid=`mynidstr|awk '{print $4}'`
-        mkdir $DIR/test_0a_dir1
-        touch $DIR/test_0a_file1
-        ln -s $DIR/test_0a_file1 $DIR/test_0a_filelink1
-        chmod 0777 $DIR
-        lctl << EOF
-        device $mdsnum 
-        root_squash 500:500
-        root_squash
-        quit
-EOF
-        mkdir $DIR/test_0a_dir2
-        touch $DIR/test_0a_file2
-        ln -s $DIR/test_0a_file2 $DIR/test_0a_filelink2
-        $CHECKSTAT -t dir   -u 500  $DIR/test_0a_dir2 || error
-        $CHECKSTAT -t file  -u 500  $DIR/test_0a_file2 || error
-        $CHECKSTAT -t link  -u 500  $DIR/test_0a_filelink2 || error
-        lctl << EOF
-        device $mdsnum 
-        root_squash 500:500 $mynid
-        root_squash
-        quit
-EOF
-        mkdir $DIR/test_0a_dir3
-        touch $DIR/test_0a_file3
-        ln -s $DIR/test_0a_file3 $DIR/test_0a_filelink3
-        $CHECKSTAT -t dir -u root  $DIR/test_0a_dir3 || error
-        $CHECKSTAT -t file -u root $DIR/test_0a_file3 || error
-        $CHECKSTAT -t link -u root $DIR/test_0a_filelink3 || error
-        lctl << EOF
-        device $mdsnum 
-        root_squash root:root
-        root_squash
-        quit
-EOF
-        mkdir $DIR/test_0a_dir4
-        touch $DIR/test_0a_file4
-        ln -s $DIR/test_0a_file4 $DIR/test_0a_filelink4
-        $CHECKSTAT -t dir -u root  $DIR/test_0a_dir4 || error
-        $CHECKSTAT -t file -u root $DIR/test_0a_file4 || error
-        $CHECKSTAT -t link -u root $DIR/test_0a_filelink4 || error
-        rm -rf $DIR/test_0a*
-        chmod 0755 $DIR
+setup() {
+       if [ -f "$SETXID_CONF" ]; then
+               mv -f $SETXID_CONF $SETXID_CONF_BAK
+       else
+               rm -f $SETXID_CONF_BAK
        fi
-}
 
-run_test 1 "test root_squash ============================"
+       if [ $LOCAL_MDT -eq 1 ]; then
+               echo $ENABLE_IDENTITY > $IDENTITY_UPCALL
+               echo -1 > $IDENTITY_FLUSH
+       fi
 
-test_2() {
-        touch $DIR/f2
-                                                                                                                             
-        #test set/get xattr
-        setfattr -n trusted.name1 -v value1 $DIR/f2 || error
-        [ "`getfattr -n trusted.name1 $DIR/f2 2> /dev/null | \
-        grep "trusted.name1"`" == "trusted.name1=\"value1\"" ] || error
-                                                                                                                             
-        setfattr -n user.author1 -v author1 $DIR/f2 || error
-        [ "`getfattr -n user.author1 $DIR/f2 2> /dev/null | \
-        grep "user.author1"`" == "user.author1=\"author1\"" ] || error
-
-        # test listxattr
-        setfattr -n trusted.name2 -v value2 $DIR/f2 || error
-        setfattr -n trusted.name3 -v value3 $DIR/f2 || error
-        [ `getfattr -d -m "^trusted" $DIR/f2 2> /dev/null | \
-        grep "trusted" | wc -l` -eq 5 ] || error
-
-                                                                                                                             
-        setfattr -n user.author2 -v author2 $DIR/f2 || error
-        setfattr -n user.author3 -v author3 $DIR/f2 || error
-        [ `getfattr -d -m "^user" $DIR/f2 2> /dev/null | \
-        grep "user" | wc -l` -eq 3 ] || error
-        #test removexattr
-        setfattr -x trusted.name1 $DIR/f2 2> /dev/null || error
-        getfattr -d -m trusted $DIR/f2 2> /dev/null | \
-        grep "trusted.name1" && error || true
-
-        setfattr -x user.author1 $DIR/f2 2> /dev/null || error
-        getfattr -d -m user $DIR/f2 2> /dev/null | \
-        grep "user.author1" && error || true
+       $RUNAS -u $ID1 ls $DIR
+       $RUNAS -u $ID2 ls $DIR
 }
-run_test 2 "set/get xattr test (trusted xattr only) ============"
-
-test_3 () {
-        SAVE_UMASK=`umask`
-        umask 022
-        USER1=rpm
-        USER2=vsx2
-        GROUP1=nobody
-        GROUP2=users
-
-        chmod +x runacltest
-        chmod +x acl_mode
-        cd $DIR
+setup
 
-       #sed -e "s/joe/$USER1/g;s/lisa/$USER2/g;s/users/$GROUP1/g;s/toolies/$GROUP2/g" $SAVE_PWD/setfacl.test | runacltest ||
-#error "$? setfacl tests failed"
+# run as different user
+test_0() {
+       rm -rf $DIR/d0
+       mkdir $DIR/d0
+
+       chown $USER1 $DIR/d0 || sec_error
+       $RUNAS -u $ID1 ls $DIR || sec_error
+       $RUNAS -u $ID1 touch $DIR/f0 && sec_error
+       $RUNAS -u $ID1 touch $DIR/d0/f1 || sec_error
+       $RUNAS -u $ID2 touch $DIR/d0/f2 && sec_error
+       touch $DIR/d0/f3 || sec_error
+       chown root $DIR/d0
+       chgrp $USER1 $DIR/d0
+       chmod 775 $DIR/d0
+       $RUNAS -u $ID1 touch $DIR/d0/f4 || sec_error
+       $RUNAS -u $ID2 touch $DIR/d0/f5 && sec_error
+       touch $DIR/d0/f6 || sec_error
+
+       rm -rf $DIR/d0
+}
+sec_run_test 0 "uid permission ============================="
+
+# setuid/gid
+test_1() {
+       rm -rf $DIR/d1
+       mkdir $DIR/d1
+
+       chown $USER1 $DIR/d1 || sec_error
+       $RUNAS -u $ID2 -v $ID1 touch $DIR/d1/f0 && sec_error
+       echo "* $ID2 setuid" > $SETXID_CONF
+       echo "enable uid $ID2 setuid"
+       echo -1 > $IDENTITY_FLUSH
+       $RUNAS -u $ID2 -v $ID1 touch $DIR/d1/f1 || sec_error
+
+       chown root $DIR/d1
+       chgrp $USER1 $DIR/d1
+       chmod 770 $DIR/d1
+       $RUNAS -u $ID2 -g $ID2 touch $DIR/d1/f2 && sec_error
+       echo "* $ID2 setuid,setgid" > $SETXID_CONF
+       echo "enable uid $ID2 setuid,setgid"
+       echo -1 > $IDENTITY_FLUSH
+       $RUNAS -u $ID2 -g $ID2 -j $ID1 touch $DIR/d1/f3 || sec_error
+       $RUNAS -u $ID2 -v $ID1 -g $ID2 -j $ID1 touch $DIR/d1/f4 || sec_error
+
+       rm -f $SETXID_CONF
+       rm -rf $DIR/d1
+       echo -1 > $IDENTITY_FLUSH
+}
+sec_run_test 1 "setuid/gid ============================="
 
-        #sed -e "s/joe/$USER1/g;s/lisa/$USER2/g;s/users/$GROUP1/g;s/toolies/$GROUP2/g" $SAVE_PWD/acl_asroot.test | runacltest || error "$? acl_asroot tests failed"
+# lfs getfacl/setfacl
+test_2() {
+       rm -rf $DIR/d2
+       mkdir $DIR/d2
+       chmod 755 $DIR/d2
+       echo xxx > $DIR/d2/f0
+       chmod 644 $DIR/d2/f0
+
+       $LFS getfacl $DIR/d2/f0 || sec_error
+       $RUNAS -u $ID1 cat $DIR/d2/f0 || sec_error
+       $RUNAS -u $ID1 touch $DIR/d2/f0 && sec_error
+
+       $LFS setfacl -m u:$USER1:w $DIR/d2/f0 || sec_error
+       $LFS getfacl $DIR/d2/f0 || sec_error
+       echo "set user $USER1 write permission on file $DIR/d2/fo"
+       $RUNAS -u $ID1 touch $DIR/d2/f0 || sec_error
+       $RUNAS -u $ID1 cat $DIR/d2/f0 && sec_error
+
+       rm -rf $DIR/d2
+}
+sec_run_test 2 "lfs getfacl/setfacl ============================="
+
+# rootsquash
+test_3() {
+       $LCTL conf_param $MDT.mdt.nosquash_nids=none
+       while grep LNET_NID_ANY $NOSQUASH_NIDS > /dev/null; do sleep 1; done
+       $LCTL conf_param $MDT.mdt.rootsquash_uid=0
+       while [ "`cat $ROOTSQUASH_UID`" -ne 0 ]; do sleep 1; done
+       $LCTL conf_param $MDT.mdt.rootsquash_gid=0
+       while [ "`cat $ROOTSQUASH_GID`" -ne 0 ]; do sleep 1; done
+
+       rm -rf $DIR/d3
+       mkdir $DIR/d3
+       chown $USER1 $DIR/d3
+       chmod 700 $DIR/d3
+       $LCTL conf_param $MDT.mdt.rootsquash_uid=$ID1
+       echo "set rootsquash uid = $ID1"
+       while [ "`cat $ROOTSQUASH_UID`" -ne $ID1 ]; do sleep 1; done
+       touch $DIR/f3_0 && sec_error
+       touch $DIR/d3/f3_1 || sec_error
+
+       $LCTL conf_param $MDT.mdt.rootsquash_uid=0
+       echo "disable rootsquash"
+       while [ "`cat $ROOTSQUASH_UID`" -ne 0 ]; do sleep 1; done
+       chown root $DIR/d3
+       chgrp $USER2 $DIR/d3
+       chmod 770 $DIR/d3
+
+       $LCTL conf_param $MDT.mdt.rootsquash_uid=$ID1
+       echo "set rootsquash uid = $ID1"
+       while [ "`cat $ROOTSQUASH_UID`" -ne $ID1 ]; do sleep 1; done
+       touch $DIR/d3/f3_2 && sec_error
+       $LCTL conf_param $MDT.mdt.rootsquash_gid=$ID2
+       echo "set rootsquash gid = $ID2"
+       while [ "`cat $ROOTSQUASH_GID`" -ne $ID2 ]; do sleep 1; done
+       touch $DIR/d3/f3_3 || sec_error
+
+       $LCTL conf_param $MDT.mdt.nosquash_nids=*
+       echo "add host in rootsquash skip list"
+       while ! grep LNET_NID_ANY $NOSQUASH_NIDS > /dev/null;
+               do sleep 1;
+       done
+       touch $DIR/f3_4 || sec_error
+
+       $LCTL conf_param $MDT.mdt.rootsquash_uid=0
+       while [ "`cat $ROOTSQUASH_UID`" -ne 0 ]; do sleep 1; done
+       $LCTL conf_param $MDT.mdt.rootsquash_gid=0
+       while [ "`cat $ROOTSQUASH_GID`" -ne 0 ]; do sleep 1; done
+       $LCTL conf_param $MDT.mdt.nosquash_nids=none
+       rm -rf $DIR/d3
+       rm -f $DIR/f3_?
+}
+sec_run_test 3 "rootsquash ============================="
+
+# bug 3285 - supplementary group should always succeed (see do_init_ucred),
+# NB: the supplementary groups are set for local client only, as for remote
+# client, the groups of the specified uid on MDT will be obtained by
+# upcall /sbin/l_getidentity and used.
+test_4() {
+        mkdir $DIR/d4
+        chmod 771 $DIR/d4
+        chgrp $ID1 $DIR/d4
+       $RUNAS -u $ID1 ls $DIR/d4 || sec_error "setgroups(1) failed"
+       grep "local client" $CLIENT_TYPE > /dev/null 2>&1 && \
+               ($RUNAS -u $ID2 -G1,2,$ID1 ls $DIR/d4 || \
+                       sec_error "setgroups(2) failed")
+       $RUNAS -u $ID2 -G1,2 ls $DIR/d4 && sec_error "setgroups(3) failed"
+       rm -rf $DIR/d4
+}
+sec_run_test 4 "set supplementary group ==============="
 
-        #sed -e "s/joe/$USER1/g;s/lisa/$USER2/g;s/users/$GROUP1/g;s/toolies/$GROUP2/g" $SAVE_PWD/acl_perm.test | runacltest || error "$? acl_perm tests failed"
+log "cleanup: ======================================================"
 
-        #sed -e "s/joe/$USER1/g;s/lisa/$USER2/g;s/users/$GROUP1/g;s/toolies/$GROUP2/g" $SAVE_PWD/acl_misc.test | runacltest || error "$? acl_misc tests failed"
+unsetup() {
+       if [ -f "$SETXID_CONF_BAK" ]; then
+               mv -f $SETXID_CONF_BAK $SETXID_CONF
+       fi
 
-        sed -e "s/joe/$USER1/g;s/lisa/$USER2/g;s/users/$GROUP1/g;s/toolies/$GROUP2/g" $SAVE_PWD/acl_fileutil.test | runacltest || error "$? acl_fileutil tests failed"
+       if [ $LOCAL_MDT -eq 1 ]; then
+               echo $IDENTITY_UPCALL_BAK > $IDENTITY_UPCALL
+               echo -1 > $IDENTITY_FLUSH
+       fi
 
-        umask $SAVE_UMASK
+       $RUNAS -u $ID1 ls $DIR
+       $RUNAS -u $ID2 ls $DIR
 }
-run_test 3 "==============acl test ============="
+unsetup
 
-TMPDIR=$OLDTMPDIR
-TMP=$OLDTMP
-HOME=$OLDHOME
-
-log "cleanup: ======================================================"
-if [ "`mount | grep ^$NAME`" ]; then
-       rm -rf $DIR/[Rdfs][1-9]*
-       if [ "$I_MOUNTED" = "yes" ]; then
-               sh llmountcleanup.sh || error
+sec_cleanup() {
+       if [ "$S_MOUNTED" = "yes" ]; then
+               cleanupall -f || sec_error "cleanup failed"
        fi
-fi
+}
+sec_cleanup
 
 echo '=========================== finished ==============================='
-[ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true
+[ -f "$SANITYSECLOG" ] && cat $SANITYSECLOG && exit 1 || true