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/nfsgen.kshlib
31
32 # Turn on debug info, if requested
33 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
34 && set -x
35
36 # These tests don't support krb5, so nothing to do.
37 [[ $IS_KRB5 == 1 ]] && cleanup $STF_UNTESTED
38
39 # Restore SERVER's delegation, ignore if SETUP=none
40 if [[ $SETUP != none ]]; then
41 # Set it to default "on" if unable to locate the orginal value
42 deleg_val=$(grep -i _delegation $STF_TMPDIR/$SERVER.deleg_val | \
43 awk -F\= '{print $2}')
44 [[ -z $deleg_val ]] && deleg_val="on"
45
46 # and only reset it at server if it's different from current setting
47 if [[ ! -f $STF_TMPDIR/deleg_been_set || \
48 `cat $STF_TMPDIR/deleg_been_set` != "$deleg_val" ]]; then
49 RSH root $SERVER \
50 ". $SRV_TMPDIR/srv_env.vars && \
51 . $SRV_TMPDIR/nfs-util.kshlib && \
52 set_nfs_property NFS_SERVER_DELEGATION $deleg_val" \
53 > $STF_TMPDIR/set_deleg.$$ 2>&1
54 if (( $? != 0 )); then
55 echo "WARNING: failed to reset delegation to \c"
56 echo "<$deleg_val> on SERVER=<$SERVER>"
57 cat $STF_TMPDIR/set_deleg.$$
58 cleanup $STF_WARNING
59 fi
60 rm -f $STF_TMPDIR/$SERVER.deleg_val \
61 $STF_TMPDIR/set_deleg.$$ $STF_TMPDIR/deleg_been_set
62 fi
63 else
64 echo "$NAME: <SETUP=none>"
65 echo "\tPlease verify SERVER's delegation is reset to valid value."
66 cleanup $STF_PASS "" \
67 "$STF_TMPDIR/srv_env.vars $STF_TMPDIR/deleg_been_set"
68 fi