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 # libmapid04.sh - libmapid 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 # comment out NFSMAPID_DOMAIN string in /etc/default/nfs
43 comm_domain_default_nfs
44
45 # remove /etc/resolv.conf
46 rm -f /etc/resolv.conf
47
48 # refresh nfsmapid
49 mapid_service refresh $TIMEOUT "failed to refresh mapid service" \
50 "ERROR" || exit $UNINITIATED
51
52 # assertion list
53 ASSERTIONS=${ASSERTIONS:-"a b"}
54
55 # generate assertion descriptions
56 gen_assert_desc $NAME "as_"
57
58 #
59 # Assertion definition
60 #
61
62 # as_a: No domain in /etc/default/nfs, no /etc/resolv.conf, call
63 # mapid_get_domain(), get domain from NIS
64 function as_a {
65 [[ -n "$DEBUG" ]] && [[ $DEBUG != 0 ]] && set -x
66
67 exp=$nis_domain
68 assertion a "$(get_assert_desc a)" $exp
69
70 # Get mapid domain
71 act=$(./get_domain)
72 ckreturn $? "get_domain utility failed" /dev/null "UNRESOLVED" \
73 || return $UNRESOLVED
74
75 # check assertion
76 ckres2 "get_domain" "$act" "$exp" "domains differ" || return $FAIL
77 }
78
79 # as_b: No domain in /etc/default/nfs, no /etc/resolv.conf, call
80 # mapid_derive_domain(), get domain from NIS
81 function as_b {
82 [[ -n "$DEBUG" ]] && [[ $DEBUG != 0 ]] && set -x
83
84 exp=$nis_domain
85 assertion b "$(get_assert_desc b)" $exp
86
87 # Get mapid domain
88 act=$(./derive_domain_dl)
89 ckreturn $? "derive_domain_dl utility failed" /dev/null "UNRESOLVED" \
90 || return $UNRESOLVED
91
92 # check assertion
93 ckres2 "derive_domain_dl" "$act" "$exp" "domains differ" || return $FAIL
94 }
95
96 #
97 # Run assertions
98 #
99
100 echo "\nLIBMAPID04 Starting Assertions\n"
101
102 for i in $ASSERTIONS
103 do
104 eval as_${i} || print_state
105 done
106
107 echo "\nLIBMAPID04 assertions finished!\n"