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 . ${STF_SUITE}/tests/delegation/include/delegation.kshlib
30
31 # Turn on debug info, if requested
32 NAME=$(basename $0)
33 [[ :${NFSGEN_DEBUG}: == *:${NAME}:* \
34 || :${NFSGEN_DEBUG}: == *:all:* ]] && set -x
35
36 # Check CLIENT2 is set and reachable
37 if [[ -z $CLIENT2 ]]; then
38 print -u2 "CLIENT2 variable must be set, exiting."
39 exit $STF_UNTESTED
40 fi
41
42 if [[ $CLIENT2 == $SERVER ]] && [[ $SETUP == "none" ]] ; then
43 print -u2 "Skip tests in this subdir[SETUP: $SETUP, CLIENT2: $CLIENT2]"
44 exit $STF_UNTESTED
45 fi
46
47 RUN_CHECK /usr/sbin/ping $CLIENT2 || exit $STF_UNINITIATED
48 RUN_CHECK RSH root $CLIENT2 "mkdir -p $SRV_TMPDIR/delegation/bin" || \
49 exit $STF_UNINITIATED
50
51 [[ $IS_KRB5 == 1 ]] && KOPT=",$SecOPT" || KOPT=""
52 if [[ $CLIENT2 != $SERVER ]]; then
53 # Mount test dirs on CLIENT2
54 # make sure to use the same path as current client
55 realMNT=$(get_realMNT $MNTDIR 2> $STF_TMPDIR/$NAME.err.$$)
56 (( $? != 0 )) && cleanup $STF_UNINITIATED $STF_TMPDIR/$NAME.err.$$
57 mDIR=$(echo $MNTDIR | sed "s%$realMNT%%")
58 nSDIR=${SHRDIR}${mDIR}
59
60 RUN_CHECK RSH root $CLIENT2 \
61 "mkdir -p $CLNT2_MNTDIRV4 $CLNT2_MNTDIRV3 $CLNT2_MNTDIRV2" || \
62 exit $STF_FAIL
63 if [[ -z $ZONE_PATH ]]; then
64 RUN_CHECK RSH root $CLIENT2 \
65 "mkdir -p $CLNT2_MNTDIRV4 $CLNT2_MNTDIRV3 $CLNT2_MNTDIRV2" || \
66 exit $STF_FAIL
67 RUN_CHECK RSH root $CLIENT2 \
68 "\"mount -o $CLNT2_MNTOPTV4 $SERVER:$nSDIR $CLNT2_MNTDIRV4 && \
69 mount -o $CLNT2_MNTOPTV3 $SERVER:$nSDIR $CLNT2_MNTDIRV3 && \
70 mount -o $CLNT2_MNTOPTV2$KOPT $SERVER:$nSDIR $CLNT2_MNTDIRV2\"" \
71 || exit $STF_FAIL
72 else
73 # TX doesn't support nfsv2
74 RUN_CHECK RSH root $CLIENT2 \
75 "mkdir -p $CLNT2_MNTDIRV4 $CLNT2_MNTDIRV3" || \
76 exit $STF_FAIL
77 RUN_CHECK RSH root $CLIENT2 \
78 "\"mount -o $CLNT2_MNTOPTV4 $SERVER:$nSDIR $CLNT2_MNTDIRV4 && \
79 mount -o $CLNT2_MNTOPTV3 $SERVER:$nSDIR $CLNT2_MNTDIRV3\"" \
80 || exit $STF_FAIL
81 fi
82 fi
83
84 # put variables into a file on the CLIENT2, and source it before
85 # calling the programs(file_operator,chg_usr_exec).
86 echo "export LD_LIBRARY_PATH=$SRV_TMPDIR/delegation/bin" \
87 > $STF_TMPDIR/deleg.env
88
89 # Copy utilites on CLIENT2(or SERVER)
90 filelist="${STF_SUITE}/tests/delegation/bin/${CLIENT2_ARCH}/* \
91 ${STF_SUITE}/lib/${CLIENT2_ARCH}/libnfsgen.so \
92 ${STF_SUITE}/bin/${CLIENT2_ARCH}/file_operator \
93 ${STF_SUITE}/bin/${CLIENT2_ARCH}/chg_usr_exec"
94
95 if [[ $CLIENT2_BIN_USED == 0 ]]; then
96 RUN_CHECK rcp $filelist $STF_TMPDIR/deleg.env \
97 $CLIENT2:$SRV_TMPDIR/delegation/bin \
98 || exit $STF_FAIL
99 else
100 RUN_CHECK rcp $STF_TMPDIR/deleg.env $CLIENT2:$SRV_TMPDIR/delegation/bin \
101 || exit $STF_FAIL
102 RUN_CHECK RSH root $CLIENT2 "cp $filelist $SRV_TMPDIR/delegation/bin" \
103 || exit $STF_FAIL
104 fi
105
106 exit $STF_PASS