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_test
42 #
43 # DESCRIPTION:
44 # For the wrong SHROPT/MNTOPT and export/mount the SERVER's filesystems
45 #
46 # STRATEGY:
47 # verify the share and mount/automount fail
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_MNT*)
73 share_check "rw"
74 do_neg_mount_check "$Opts"
75 do_neg_automount_check "$Opts" "NBASIC"
76 ;;
77 NEG_SH*)
78 do_neg_share_check "$Opts"
79 ;;
80 NEG_ACCESS*)
81 share_check "$Other_opts"
82 if [[ $Other_opts == *"anon=-1"* && \
83 ,$Opts, == @(*,vers=2,*|*,vers=3,*) ]]; then
84 domount_check "$Opts"
85 do_neg_ro_test
86 # but non-root user can access the mount point
87 do_rw_test WRITER $TUSER01
88 unmount_check
89 else
90 do_neg_mount_check "$Opts"
91 do_neg_automount_check "$Opts" "NBASIC"
92 fi
93 ;;
94 *)
95 echo "$Tname: error - it is unreachable - Result FAIL"
96 exit $STF_UNRESOLVED
97 ;;
98 esac
99
100 echo "$NAME: testing complete - Result PASS"
101 cleanup $STF_PASS