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 # libmapid05.sh - libmapid tests for the following configuration:
28 #
29 # NFSMAPID_DOMAIN DNS TXT RR DNS domain NIS domain
30 # =============== ============== ========== ==========
31 # No No No No
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 # nullify NIS domain
49 domainname ""
50
51 # refresh nfsmapid
52 mapid_service refresh $TIMEOUT "failed to refresh mapid service" \
53 "ERROR" || exit $UNINITIATED
54
55 # assertion list
56 ASSERTIONS=${ASSERTIONS:-"a b"}
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, no NIS domain, call
66 # mapid_get_domain(), domain is null
67 function as_a {
68 [[ -n "$DEBUG" ]] && [[ $DEBUG != 0 ]] && set -x
69
70 exp=""
71 assertion a "$(get_assert_desc a)" NULL
72
73 # Get mapid domain
74 act=$(./get_domain)
75 ckreturn $? "get_domain utility failed" /dev/null "UNRESOLVED" \
76 || return $UNRESOLVED
77
78 # check assertion
79 ckres2 "get_domain" "$act" "$exp" "domains differ" || return $FAIL
80 }
81
82 # as_b: No domain in /etc/default/nfs, no /etc/resolv.conf, no NIS domain, call
83 # mapid_derive_domain(), domain is null
84 function as_b {
85 [[ -n "$DEBUG" ]] && [[ $DEBUG != 0 ]] && set -x
86
87 exp=""
88 assertion b "$(get_assert_desc b)" NULL
89
90 # Get mapid domain
91 act=$(./derive_domain_dl)
92 ckreturn $? "derive_domain_dl utility failed" /dev/null "UNRESOLVED" \
93 || return $UNRESOLVED
94
95 # check assertion
96 ckres2 "derive_domain_dl" "$act" "$exp" "domains differ" || return $FAIL
97 }
98
99 #
100 # Run assertions
101 #
102
103 echo "\nLIBMAPID05 Starting Assertions\n"
104
105 for i in $ASSERTIONS
106 do
107 eval as_${i} || print_state
108 done
109
110 echo "\nLIBMAPID05 assertions finished!\n"