etc/services - sync with NetBSD-8
[minix.git] / external / bsd / bind / dist / bin / tests / system / zonechecks / tests.sh
bloba1676e0dea88f80d81e87e4350ab94f6ed7636e2
1 #!/bin/sh
3 # Copyright (C) 2004, 2007, 2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC")
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 # PERFORMANCE OF THIS SOFTWARE.
17 SYSTEMTESTTOP=..
18 . $SYSTEMTESTTOP/conf.sh
20 status=0
23 echo "I: checking that we detect a NS which refers to a CNAME"
24 if $CHECKZONE . cname.db > cname.out 2>&1
25 then
26 echo "I:failed (status)"; status=`expr $status + 1`
27 else
28 if grep "is a CNAME" cname.out > /dev/null
29 then
31 else
32 echo "I:failed (message)"; status=`expr $status + 1`
37 echo "I: checking that we detect a NS which is below a DNAME"
38 if $CHECKZONE . dname.db > dname.out 2>&1
39 then
40 echo "I:failed (status)"; status=`expr $status + 1`
41 else
42 if grep "is below a DNAME" dname.out > /dev/null
43 then
45 else
46 echo "I:failed (message)"; status=`expr $status + 1`
51 echo "I: checking that we detect a NS which has no address records (A/AAAA)"
52 if $CHECKZONE . noaddress.db > noaddress.out
53 then
54 echo "I:failed (status)"; status=`expr $status + 1`
55 else
56 if grep "has no address records" noaddress.out > /dev/null
57 then
59 else
60 echo "I:failed (message)"; status=`expr $status + 1`
65 echo "I: checking that we detect a NS which has no records"
66 if $CHECKZONE . nxdomain.db > nxdomain.out
67 then
68 echo "I:failed (status)"; status=`expr $status + 1`
69 else
70 if grep "has no address records" noaddress.out > /dev/null
71 then
73 else
74 echo "I:failed (message)"; status=`expr $status + 1`
79 echo "I: checking that we detect a NS which looks like a A record (fail)"
80 if $CHECKZONE -n fail . a.db > a.out 2>&1
81 then
82 echo "I:failed (status)"; status=`expr $status + 1`
83 else
84 if grep "appears to be an address" a.out > /dev/null
85 then
87 else
88 echo "I:failed (message)"; status=`expr $status + 1`
93 echo "I: checking that we detect a NS which looks like a A record (warn=default)"
94 if $CHECKZONE . a.db > a.out 2>&1
95 then
96 if grep "appears to be an address" a.out > /dev/null
97 then
99 else
100 echo "I:failed (message)"; status=`expr $status + 1`
102 else
103 echo "I:failed (status)"; status=`expr $status + 1`
107 echo "I: checking that we detect a NS which looks like a A record (ignore)"
108 if $CHECKZONE -n ignore . a.db > a.out 2>&1
109 then
110 if grep "appears to be an address" a.out > /dev/null
111 then
112 echo "I:failed (message)"; status=`expr $status + 1`
113 else
116 else
117 echo "I:failed (status)"; status=`expr $status + 1`
121 echo "I: checking that we detect a NS which looks like a AAAA record (fail)"
122 if $CHECKZONE -n fail . aaaa.db > aaaa.out 2>&1
123 then
124 echo "I:failed (status)"; status=`expr $status + 1`
125 else
126 if grep "appears to be an address" aaaa.out > /dev/null
127 then
129 else
130 echo "I:failed (message)"; status=`expr $status + 1`
135 echo "I: checking that we detect a NS which looks like a AAAA record (warn=default)"
136 if $CHECKZONE . aaaa.db > aaaa.out 2>&1
137 then
138 if grep "appears to be an address" aaaa.out > /dev/null
139 then
141 else
142 echo "I:failed (message)"; status=`expr $status + 1`
144 else
145 echo "I:failed (status)"; status=`expr $status + 1`
149 echo "I: checking that we detect a NS which looks like a AAAA record (ignore)"
150 if $CHECKZONE -n ignore . aaaa.db > aaaa.out 2>&1
151 then
152 if grep "appears to be an address" aaaa.out > /dev/null
153 then
154 echo "I:failed (message)"; status=`expr $status + 1`
155 else
158 else
159 echo "I:failed (status)"; status=`expr $status + 1`
163 echo "I: checking 'rdnc zonestatus' output"
164 ret=0
165 for i in 0 1 2 3 4 5 6 7 8 9
167 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 zonestatus master.example > rndc.out.master 2>&1
168 grep "zone not loaded" rndc.out.master > /dev/null || break
169 sleep 1
170 done
171 checkfor() {
172 grep "$1" $2 > /dev/null || {
173 ret=1;
174 echo "I: missing '$1' from '$2'"
177 checkfor "name: master.example" rndc.out.master
178 checkfor "type: master" rndc.out.master
179 checkfor "files: master.db, master.db.signed" rndc.out.master
180 checkfor "serial: " rndc.out.master
181 checkfor "nodes: " rndc.out.master
182 checkfor "last loaded: " rndc.out.master
183 checkfor "secure: yes" rndc.out.master
184 checkfor "inline signing: no" rndc.out.master
185 checkfor "key maintenance: automatic" rndc.out.master
186 checkfor "next key event: " rndc.out.master
187 checkfor "next resign node: " rndc.out.master
188 checkfor "next resign time: " rndc.out.master
189 checkfor "dynamic: yes" rndc.out.master
190 checkfor "frozen: no" rndc.out.master
191 for i in 0 1 2 3 4 5 6 7 8 9
193 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 zonestatus master.example > rndc.out.slave 2>&1
194 grep "zone not loaded" rndc.out.slave > /dev/null || break
195 sleep 1
196 done
197 checkfor "name: master.example" rndc.out.slave
198 checkfor "type: slave" rndc.out.slave
199 checkfor "files: slave.db" rndc.out.slave
200 checkfor "serial: " rndc.out.slave
201 checkfor "nodes: " rndc.out.slave
202 checkfor "next refresh: " rndc.out.slave
203 checkfor "expires: " rndc.out.slave
204 checkfor "secure: yes" rndc.out.slave
205 for i in 0 1 2 3 4 5 6 7 8 9
207 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 zonestatus reload.example > rndc.out.prereload 2>&1
208 grep "zone not loaded" rndc.out.prereload > /dev/null || break
209 sleep 1
210 done
211 checkfor "files: reload.db, soa.db$" rndc.out.prereload
212 echo "@ 0 SOA . . 2 0 0 0 0" > ns1/soa.db
213 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reload reload.example
214 for i in 0 1 2 3 4 5 6 7 8 9
216 $DIG reload.example SOA @10.53.0.1 -p 5300 > dig.out
217 grep " 2 0 0 0 0" dig.out >/dev/null && break
218 sleep 1
219 done
220 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 zonestatus reload.example > rndc.out.postreload 2>&1
221 checkfor "files: reload.db, soa.db$" rndc.out.postreload
222 sleep 1
223 echo "@ 0 SOA . . 3 0 0 0 0" > ns1/reload.db
224 echo "@ 0 NS ." >> ns1/reload.db
225 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reload reload.example
226 for i in 0 1 2 3 4 5 6 7 8 9
228 $DIG reload.example SOA @10.53.0.1 -p 5300 > dig.out
229 grep " 3 0 0 0 0" dig.out >/dev/null && break
230 sleep 1
231 done
232 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 zonestatus reload.example > rndc.out.removeinclude 2>&1
233 checkfor "files: reload.db$" rndc.out.removeinclude
235 if [ $ret != 0 ]; then echo "I:failed"; fi
236 status=`expr $status + $ret`
238 echo "I: checking 'rdnc zonestatus' with duplicated zone name"
239 ret=0
240 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 zonestatus duplicate.example > rndc.out.duplicate 2>&1
241 checkfor "zone 'duplicate.example' was found in multiple views" rndc.out.duplicate
242 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 zonestatus duplicate.example in primary > rndc.out.duplicate 2>&1
243 checkfor "name: duplicate.example" rndc.out.duplicate
244 $RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 zonestatus nosuchzone.example > rndc.out.duplicate 2>&1
245 checkfor "no matching zone 'nosuchzone.example' in any view" rndc.out.duplicate
246 if [ $ret != 0 ]; then echo "I:failed"; fi
247 status=`expr $status + $ret`
249 echo "I:exit status: $status"
250 exit $status