1 #! /usr/bin/ksh -p
   2 #
   3 # CDDL HEADER START
   4 #
   5 # The contents of this file are subject to the terms of the
   6 # Common Development and Distribution License (the "License").
   7 # You may not use this file except in compliance with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 
  28 . ${STF_SUITE}/include/nfsgen.kshlib
  29 
  30 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
  31        && set -x
  32 
  33 if [[ $SETUP == none ]]; then
  34         echo "SETUP=<$SETUP>"
  35         echo "    We assume the following users and groups are available in"
  36         echo "    both client and server that are under testing :"
  37         echo "\tgroups: ACL_STAFF_GROUP=<$ACL_STAFF_GROUP> \c"
  38         echo "ACL_OTHER_GROUP=<$ACL_OTHER_GROUP>"
  39         echo "\tusers:  ACL_ADMIN=<$ACL_ADMIN> ACL_STAFF1=<$ACL_STAFF1>"
  40         echo "\t        ACL_STAFF2=<$ACL_STAFF2> ACL_OTHER1=<$ACL_OTHER1> \c"
  41         echo "ACL_OTHER2=<$ACL_OTHER2>"
  42         echo "    And the test filesystem on server side is ZFS, \c"
  43         echo "otherwise ACL tests will FAIL"
  44         exit $STF_PASS
  45 fi
  46 
  47 if [[ ${TestZFS} != 1 ]]; then
  48         echo "\tThe test filesystem on server is not ZFS, FS_TYPE=<$FS_TYPE>;"
  49         echo "\tACL tests won't run"
  50         exit $STF_PASS
  51 fi
  52 
  53 # Add root group user
  54 add_user -g root $ACL_ADMIN $SERVER > $STF_TMPDIR/usradd.$$ \
  55         || exit $STF_UNINITIATED $STF_TMPDIR/usradd.$$
  56 
  57 # Create "staff" group.
  58 add_group $ACL_STAFF_GROUP $SERVER > $STF_TMPDIR/grpadd.$$ 2>&1 \
  59         || exit $STF_UNINITIATED $STF_TMPDIR/grpadd.$$
  60 
  61 # add two user for $ACL_STAFF_GROUP group
  62 for user in $ACL_STAFF1 $ACL_STAFF2; do
  63         add_user -g $ACL_STAFF_GROUP $user $SERVER > $STF_TMPDIR/usradd.$$ 2>&1 \
  64                 || exit $STF_FAIL $STF_TMPDIR/usradd.$$
  65 done
  66 
  67 # Create the user principals if it's krb5 testing
  68 if [[ $IS_KRB5 == 1 ]]; then
  69         if [[ -f $KRB5_NO_CLEANUP_FILE ]]; then
  70                 echo "\t The test uses existing Kerberos setup."
  71                 echo "\t Please make sure you have created all principals\c"
  72                 echo "($ACL_ADMIN,$ACL_STAFF1,$ACL_STAFF2,$ACL_OTHER1,$ACL_OTHER2) !!"
  73         else
  74                 for user in $ACL_ADMIN $ACL_STAFF1 $ACL_STAFF2; do
  75                         ${KRB5TOOLS_HOME}/bin/princadm -c -p $user >/dev/null 2>&1
  76                         RUN_CHECK ${KRB5TOOLS_HOME}/bin/princadm -s \
  77                             -p $user,password=$KPASSWORD || exit $STF_FAIL
  78                 done
  79         fi
  80 fi
  81 
  82 exit $STF_PASS