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 NAME=$(basename $0)
  29 
  30 . $STF_SUITE/include/sharemnt.kshlib
  31 . $STC_GENUTILS/include/nfs-tx.kshlib
  32 
  33 export STC_GENUTILS_DEBUG=$STC_GENUTILS_DEBUG:$SHAREMNT_DEBUG
  34 [[ :${SHAREMNT_DEBUG}: == *:${NAME}:* \
  35                 || :${SHAREMNT_DEBUG}: == *:all:* ]] && set -x
  36 
  37 ################################################################################
  38 #
  39 # __stc_assertion_start
  40 #
  41 # ID: neg_access
  42 #
  43 # DESCRIPTION:
  44 #   For the invalid SHROPT/MNTOPT related to access list
  45 #
  46 # STRATEGY:
  47 #   verify the share and mount/automount fail with invalid/denied access list
  48 #
  49 # TESTABILITY: explicit
  50 #
  51 # TEST_AUTOMATION_LEVEL: automated
  52 #
  53 # __stc_assertion_end
  54 #
  55 ################################################################################
  56 
  57 USAGE="Usage: $0 Test_name opts..."
  58 
  59 if (( $# < 2 )); then
  60         echo "$USAGE"
  61         exit $STF_UNRESOLVED
  62 fi
  63 
  64 typeset Tname=$1
  65 typeset Opts=$2
  66 typeset Other_opts=$3
  67 
  68 # Check TX related info
  69 check_for_cipso "$SHRDIR" "$MNTDIR" "$Opts" || return $STF_UNSUPPORTED
  70 
  71 case $Tname in
  72 NEG_ACCESS*)
  73         share_check "$Other_opts"
  74         if [[ $Other_opts == *"anon=-1"* && \
  75                 ,$Opts, == @(*,vers=2,*|*,vers=3,*) ]]; then
  76                 domount_check "$Opts"
  77                 do_neg_ro_test
  78                 # but non-root user can access the mount point
  79                 do_rw_test WRITER $TUSER01
  80                 unmount_check
  81         else
  82                 do_neg_mount_check "$Opts"
  83                 do_neg_automount_check "$Opts" "NBASIC"
  84         fi
  85         ;;
  86 *)
  87         echo "$Tname: error - it is unreachable - Result FAIL"
  88         exit $STF_UNRESOLVED
  89         ;;
  90 esac
  91 
  92 echo "$NAME: testing complete - Result PASS"
  93 cleanup $STF_PASS