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 2006 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27 # nfsmapid04.sh - nfsmapid tests for the following configuration:
28 #
29 # NFSMAPID_DOMAIN DNS TXT RR DNS domain NIS domain
30 # =============== ============== ========== ==========
31 # No No No Yes
32 #
33
34 [[ -n "$DEBUG" ]] && [[ $DEBUG != 0 ]] && set -x
35
36 # set up script execution environment
37 . ./dom_env
38
39 # should run as root
40 is_root "$NAME{setup}:" "All tests for domain affected"
41
42 # get timeout value nfsmapid uses for domain checking
43 nfsdomain_tmout=$(get_nfsmapid_domain_tout_wrapper)
44
45 # comment out NFSMAPID_DOMAIN string in /etc/default/nfs
46 comm_domain_default_nfs
47
48 # remove /etc/resolv.conf
49 rm -f /etc/resolv.conf
50
51 # refresh nfsmapid server
52 mapid_service refresh $TIMEOUT "failed to refresh mapid service" \
53 "UNRESOLVED" || exit $UNRESOLVED
54
55 # assertion list
56 ASSERTIONS=${ASSERTIONS:-"a"}
57
58 # generate assertion descriptions
59 gen_assert_desc $NAME "as_"
60
61 #
62 # Assertion definition
63 #
64
65 # as_a: No domain in /etc/default/nfs, no /etc/resolv.conf, get domain from NIS
66 function as_a {
67 [[ -n "$DEBUG" ]] && [[ $DEBUG != 0 ]] && set -x
68
69 exp=$nis_domain
70 assertion a "$(get_assert_desc a)" $exp
71
72 # Get mapid domain
73 act=$(get_nfsmapid_domain)
74
75 # Check Assertion
76 ckres2 "get_nfsmapid_domain" "$act" "$exp" "domains differ" \
77 || return $FAIL
78 }
79
80 #
81 # Run assertions
82 #
83
84 echo "\nNFSMAPID04 Starting Assertions\n"
85
86 for i in $ASSERTIONS
87 do
88 eval as_${i} || print_state
89 done
90
91 echo "\nNFSMAPID04 assertions finished!\n"