Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / bin / tests / system / nsupdate / tests.sh
blobb57ed2bd512c2871df2ef297adbd22d8d398bdcb
1 #!/bin/sh
3 # Copyright (C) 2004, 2007, 2009-2014 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000, 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: tests.sh,v 1.42 2011/12/16 23:01:17 each Exp
20 SYSTEMTESTTOP=..
21 . $SYSTEMTESTTOP/conf.sh
23 status=0
24 n=0
26 # wait for zone transfer to complete
27 tries=0
28 while true; do
29 if [ $tries -eq 10 ]
30 then
31 exit 1
34 if grep "example.nil/IN.*Transfer completed" ns2/named.run > /dev/null
35 then
36 break
37 else
38 echo "I:zones are not fully loaded, waiting..."
39 tries=`expr $tries + 1`
40 sleep 1
42 done
44 ret=0
45 echo "I:fetching first copy of zone before update"
46 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
47 @10.53.0.1 axfr -p 5300 > dig.out.ns1 || ret=1
48 [ $ret = 0 ] || { echo I:failed; status=1; }
50 ret=0
51 echo "I:fetching second copy of zone before update"
52 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
53 @10.53.0.2 axfr -p 5300 > dig.out.ns2 || ret=1
54 [ $ret = 0 ] || { echo I:failed; status=1; }
56 ret=0
57 echo "I:comparing pre-update copies to known good data"
58 $PERL ../digcomp.pl knowngood.ns1.before dig.out.ns1 || ret=1
59 $PERL ../digcomp.pl knowngood.ns1.before dig.out.ns2 || ret=1
60 [ $ret = 0 ] || { echo I:failed; status=1; }
62 ret=0
63 echo "I:updating zone"
64 # nsupdate will print a ">" prompt to stdout as it gets each input line.
65 $NSUPDATE -k ns1/ddns.key <<END > /dev/null || ret=1
66 server 10.53.0.1 5300
67 update add updated.example.nil. 600 A 10.10.10.1
68 add updated.example.nil. 600 TXT Foo
69 delete t.example.nil.
71 END
72 [ $ret = 0 ] || { echo I:failed; status=1; }
74 echo "I:sleeping 5 seconds for server to incorporate changes"
75 sleep 5
77 ret=0
78 echo "I:fetching first copy of zone after update"
79 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
80 @10.53.0.1 axfr -p 5300 > dig.out.ns1 || ret=1
81 [ $ret = 0 ] || { echo I:failed; status=1; }
83 ret=0
84 echo "I:fetching second copy of zone after update"
85 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
86 @10.53.0.2 axfr -p 5300 > dig.out.ns2 || ret=1
87 [ $ret = 0 ] || { echo I:failed; status=1; }
89 ret=0
90 echo "I:comparing post-update copies to known good data"
91 $PERL ../digcomp.pl knowngood.ns1.after dig.out.ns1 || ret=1
92 $PERL ../digcomp.pl knowngood.ns1.after dig.out.ns2 || ret=1
93 [ $ret = 0 ] || { echo I:failed; status=1; }
95 ret=0
96 echo "I:testing local update policy"
97 pre=`$DIG +short new.other.nil. @10.53.0.1 a -p 5300` || ret=1
98 [ -z "$pre" ] || ret=1
99 [ $ret = 0 ] || { echo I:failed; status=1; }
101 ret=0
102 echo "I:updating zone"
103 # nsupdate will print a ">" prompt to stdout as it gets each input line.
104 $NSUPDATE -l -p 5300 -k ns1/session.key > /dev/null <<END || ret=1
105 zone other.nil.
106 update add new.other.nil. 600 IN A 10.10.10.1
107 send
109 [ $ret = 0 ] || { echo I:failed; status=1; }
111 echo "I:sleeping 5 seconds for server to incorporate changes"
112 sleep 5
114 ret=0
115 echo "I:checking result of update"
116 post=`$DIG +short new.other.nil. @10.53.0.1 a -p 5300` || ret=1
117 [ "$post" = "10.10.10.1" ] || ret=1
118 [ $ret = 0 ] || { echo I:failed; status=1; }
120 ret=0
121 echo "I:comparing post-update copy to known good data"
122 $PERL ../digcomp.pl knowngood.ns1.after dig.out.ns1 || ret=1
123 [ $ret = 0 ] || { echo I:failed; status=1; }
125 ret=0
126 echo "I:testing zone consistency checks"
127 # inserting an NS record without a corresponding A or AAAA record should fail
128 $NSUPDATE -l -p 5300 -k ns1/session.key > nsupdate.out 2>&1 << END && ret=1
129 update add other.nil. 600 in ns ns3.other.nil.
130 send
132 grep REFUSED nsupdate.out > /dev/null 2>&1 || ret=1
133 # ...but should work if an A record is inserted first:
134 $NSUPDATE -l -p 5300 -k ns1/session.key > nsupdate.out 2>&1 << END || ret=1
135 update add ns4.other.nil 600 in a 10.53.0.1
136 send
137 update add other.nil. 600 in ns ns4.other.nil.
138 send
140 grep REFUSED nsupdate.out > /dev/null 2>&1 && ret=1
141 # ...or if an AAAA record does:
142 $NSUPDATE -l -p 5300 -k ns1/session.key > nsupdate.out 2>&1 << END || ret=1
143 update add ns5.other.nil 600 in aaaa 2001:db8::1
144 send
145 update add other.nil. 600 in ns ns5.other.nil.
146 send
148 grep REFUSED nsupdate.out > /dev/null 2>&1 && ret=1
149 # ...or if the NS and A/AAAA are inserted together:
150 $NSUPDATE -l -p 5300 -k ns1/session.key > nsupdate.out 2>&1 << END || ret=1
151 update add other.nil. 600 in ns ns6.other.nil.
152 update add ns6.other.nil 600 in a 10.53.0.1
153 send
155 grep REFUSED nsupdate.out > /dev/null 2>&1 && ret=1
156 [ $ret = 0 ] || { echo I:failed; status=1; }
158 echo "I:sleeping 5 seconds for server to incorporate changes"
159 sleep 5
161 ret=0
162 echo "I:checking result of update"
163 $DIG +short @10.53.0.1 -p 5300 ns other.nil > dig.out.ns1 || ret=1
164 grep ns3.other.nil dig.out.ns1 > /dev/null 2>&1 && ret=1
165 grep ns4.other.nil dig.out.ns1 > /dev/null 2>&1 || ret=1
166 grep ns5.other.nil dig.out.ns1 > /dev/null 2>&1 || ret=1
167 grep ns6.other.nil dig.out.ns1 > /dev/null 2>&1 || ret=1
168 [ $ret = 0 ] || { echo I:failed; status=1; }
170 ret=0
171 echo "I:check SIG(0) key is accepted"
172 key=`$KEYGEN -q -r $RANDFILE -a NSEC3RSASHA1 -b 512 -T KEY -n ENTITY xxx`
173 echo "" | $NSUPDATE -k ${key}.private > /dev/null 2>&1 || ret=1
174 [ $ret = 0 ] || { echo I:failed; status=1; }
176 n=`expr $n + 1`
177 ret=0
178 echo "I:check TYPE=0 update is rejected by nsupdate ($n)"
179 $NSUPDATE <<END > nsupdate.out 2>&1 && ret=1
180 server 10.53.0.1 5300
181 ttl 300
182 update add example.nil. in type0 ""
183 send
185 grep "unknown class/type" nsupdate.out > /dev/null 2>&1 || ret=1
186 [ $ret = 0 ] || { echo I:failed; status=1; }
188 n=`expr $n + 1`
189 ret=0
190 echo "I:check TYPE=0 prerequisite is handled ($n)"
191 $NSUPDATE -k ns1/ddns.key <<END > nsupdate.out 2>&1 || ret=1
192 server 10.53.0.1 5300
193 prereq nxrrset example.nil. type0
194 send
196 $DIG +tcp version.bind txt ch @10.53.0.1 -p 5300 > dig.out.ns1.$n
197 grep "status: NOERROR" dig.out.ns1.$n > /dev/null || ret=1
198 [ $ret = 0 ] || { echo I:failed; status=1; }
200 n=`expr $n + 1`
201 ret=0
202 echo "I:check that TYPE=0 update is handled ($n)"
203 echo "a0e4280000010000000100000000060001c00c000000fe000000000000" |
204 $PERL ../packet.pl -a 10.53.0.1 -p 5300 -t tcp > /dev/null
205 $DIG +tcp version.bind txt ch @10.53.0.1 -p 5300 > dig.out.ns1.$n
206 grep "status: NOERROR" dig.out.ns1.$n > /dev/null || ret=1
207 [ $ret = 0 ] || { echo I:failed; status=1; }
209 n=`expr $n + 1`
210 echo "I:check that TYPE=0 additional data is handled ($n)"
211 echo "a0e4280000010000000000010000060001c00c000000fe000000000000" |
212 $PERL ../packet.pl -a 10.53.0.1 -p 5300 -t tcp > /dev/null
213 $DIG +tcp version.bind txt ch @10.53.0.1 -p 5300 > dig.out.ns1.$n
214 grep "status: NOERROR" dig.out.ns1.$n > /dev/null || ret=1
215 [ $ret = 0 ] || { echo I:failed; status=1; }
217 n=`expr $n + 1`
218 echo "I:check that update to undefined class is handled ($n)"
219 echo "a0e4280000010001000000000000060101c00c000000fe000000000000" |
220 $PERL ../packet.pl -a 10.53.0.1 -p 5300 -t tcp > /dev/null
221 $DIG +tcp version.bind txt ch @10.53.0.1 -p 5300 > dig.out.ns1.$n
222 grep "status: NOERROR" dig.out.ns1.$n > /dev/null || ret=1
223 [ $ret = 0 ] || { echo I:failed; status=1; }
225 n=`expr $n + 1`
226 echo "I:check that address family mismatch is handled ($n)"
227 $NSUPDATE <<END > /dev/null 2>&1 && ret=1
228 server ::1
229 local 127.0.0.1
230 update add 600 txt.example.nil in txt "test"
231 send
233 [ $ret = 0 ] || { echo I:failed; status=1; }
236 n=`expr $n + 1`
237 echo "I:check that unixtime serial number is correctly generated ($n)"
238 oldserial=`$DIG +short unixtime.nil. soa @10.53.0.1 -p 5300 | awk '{print $3}'` || ret=1
239 $NSUPDATE <<END > /dev/null 2>&1 || ret=1
240 server 10.53.0.1 5300
241 ttl 600
242 update add new.unixtime.nil in a 1.2.3.4
243 send
245 now=`$PERL -e 'print time()."\n";'`
246 sleep 1
247 serial=`$DIG +short unixtime.nil. soa @10.53.0.1 -p 5300 | awk '{print $3}'` || ret=1
248 [ "$oldserial" -ne "$serial" ] || ret=1
249 # allow up to 2 seconds difference between the serial
250 # number and the unix epoch date but no more
251 $PERL -e 'exit 1 if abs($ARGV[1] - $ARGV[0]) > 2;' $now $serial || ret=1
252 [ $ret = 0 ] || { echo I:failed; status=1; }
254 if $PERL -e 'use Net::DNS;' 2>/dev/null
255 then
256 echo "I:running update.pl test"
257 $PERL update_test.pl -s 10.53.0.1 -p 5300 update.nil. || status=1
258 else
259 echo "I:The second part of this test requires the Net::DNS library." >&2
262 ret=0
263 echo "I:fetching first copy of test zone"
264 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
265 @10.53.0.1 axfr -p 5300 > dig.out.ns1 || ret=1
266 [ $ret = 0 ] || { echo I:failed; status=1; }
268 echo "I:fetching second copy of test zone"
269 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
270 @10.53.0.2 axfr -p 5300 > dig.out.ns2 || ret=1
271 [ $ret = 0 ] || { echo I:failed; status=1; }
273 ret=0
274 echo "I:comparing zones"
275 $PERL ../digcomp.pl dig.out.ns1 dig.out.ns2 || ret=1
276 [ $ret = 0 ] || { echo I:failed; status=1; }
278 echo "I:SIGKILL and restart server ns1"
279 cd ns1
280 kill -KILL `cat named.pid`
281 rm named.pid
282 cd ..
283 sleep 10
285 $PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns1
286 then
287 echo "I:restarted server ns1"
288 else
289 echo "I:could not restart server ns1"
290 exit 1
292 sleep 10
294 ret=0
295 echo "I:fetching ns1 after hard restart"
296 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
297 @10.53.0.1 axfr -p 5300 > dig.out.ns1.after || ret=1
298 [ $ret = 0 ] || { echo I:failed; status=1; }
300 ret=0
301 echo "I:comparing zones"
302 $PERL ../digcomp.pl dig.out.ns1 dig.out.ns1.after || ret=1
303 [ $ret = 0 ] || { echo I:failed; status=1; }
305 echo "I:begin RT #482 regression test"
307 ret=0
308 echo "I:update master"
309 $NSUPDATE -k ns1/ddns.key <<END > /dev/null || ret=1
310 server 10.53.0.1 5300
311 update add updated2.example.nil. 600 A 10.10.10.2
312 update add updated2.example.nil. 600 TXT Bar
313 update delete c.example.nil.
314 send
316 [ $ret = 0 ] || { echo I:failed; status=1; }
318 sleep 5
320 echo "I:SIGHUP slave"
321 kill -HUP `cat ns2/named.pid`
323 sleep 5
325 ret=0
326 echo "I:update master again"
327 $NSUPDATE -k ns1/ddns.key <<END > /dev/null || ret=1
328 server 10.53.0.1 5300
329 update add updated3.example.nil. 600 A 10.10.10.3
330 update add updated3.example.nil. 600 TXT Zap
331 del d.example.nil.
332 send
334 [ $ret = 0 ] || { echo I:failed; status=1; }
336 sleep 5
338 echo "I:SIGHUP slave again"
339 kill -HUP `cat ns2/named.pid`
341 sleep 5
343 echo "I:check to 'out of sync' message"
344 if grep "out of sync" ns2/named.run
345 then
346 echo "I: failed (found 'out of sync')"
347 status=1
350 echo "I:end RT #482 regression test"
352 n=`expr $n + 1`
353 ret=0
354 echo "I:start NSEC3PARAM changes via UPDATE on a unsigned zone test ($n)"
355 $NSUPDATE << EOF
356 server 10.53.0.3 5300
357 update add example 3600 nsec3param 1 0 0 -
358 send
361 sleep 1
363 # the zone is not signed. The nsec3param records should be removed.
364 # this also proves that the server is still running.
365 $DIG +tcp +noadd +nosea +nostat +noquest +nocmd +norec example.\
366 @10.53.0.3 nsec3param -p 5300 > dig.out.ns3.$n || ret=1
367 grep "ANSWER: 0" dig.out.ns3.$n > /dev/null || ret=1
368 grep "flags:[^;]* aa[ ;]" dig.out.ns3.$n > /dev/null || ret=1
369 [ $ret = 0 ] || { echo I:failed; status=1; }
371 n=`expr $n + 1`
372 ret=0
373 echo "I:change the NSEC3PARAM ttl via update ($n)"
374 $NSUPDATE << EOF
375 server 10.53.0.3 5300
376 update add nsec3param.test 3600 NSEC3PARAM 1 0 1 -
377 send
380 sleep 1
382 $DIG +tcp +noadd +nosea +nostat +noquest +nocmd +norec nsec3param.test.\
383 @10.53.0.3 nsec3param -p 5300 > dig.out.ns3.$n || ret=1
384 grep "ANSWER: 1" dig.out.ns3.$n > /dev/null || ret=1
385 grep "3600.*NSEC3PARAM" dig.out.ns3.$n > /dev/null || ret=1
386 grep "flags:[^;]* aa[ ;]" dig.out.ns3.$n > /dev/null || ret=1
387 [ $ret = 0 ] || { echo I:failed; status=1; }
389 n=`expr $n + 1`
390 ret=0
391 echo "I:add a new the NSEC3PARAM via update ($n)"
392 $NSUPDATE << EOF
393 server 10.53.0.3 5300
394 update add nsec3param.test 3600 NSEC3PARAM 1 0 4 -
395 send
398 sleep 1
400 $DIG +tcp +noadd +nosea +nostat +noquest +nocmd +norec nsec3param.test.\
401 @10.53.0.3 nsec3param -p 5300 > dig.out.ns3.$n || ret=1
402 grep "ANSWER: 2" dig.out.ns3.$n > /dev/null || ret=1
403 grep "NSEC3PARAM 1 0 4 -" dig.out.ns3.$n > /dev/null || ret=1
404 grep "flags:[^;]* aa[ ;]" dig.out.ns3.$n > /dev/null || ret=1
405 if [ $ret != 0 ] ; then echo "I: failed"; status=`expr $ret + $status`; fi
407 n=`expr $n + 1`
408 ret=0
409 echo "I:add, delete and change the ttl of the NSEC3PARAM rrset via update ($n)"
410 $NSUPDATE << EOF
411 server 10.53.0.3 5300
412 update delete nsec3param.test NSEC3PARAM
413 update add nsec3param.test 7200 NSEC3PARAM 1 0 5 -
414 send
417 sleep 1
419 $DIG +tcp +noadd +nosea +nostat +noquest +nocmd +norec nsec3param.test.\
420 @10.53.0.3 nsec3param -p 5300 > dig.out.ns3.$n || ret=1
421 grep "ANSWER: 1" dig.out.ns3.$n > /dev/null || ret=1
422 grep "7200.*NSEC3PARAM 1 0 5 -" dig.out.ns3.$n > /dev/null || ret=1
423 grep "flags:[^;]* aa[ ;]" dig.out.ns3.$n > /dev/null || ret=1
424 $JOURNALPRINT ns3/nsec3param.test.db.signed.jnl > jp.out.ns3.$n
425 # intermediate TTL changes.
426 grep "add nsec3param.test. 7200 IN NSEC3PARAM 1 0 4 -" jp.out.ns3.$n > /dev/null || ret=1
427 grep "add nsec3param.test. 7200 IN NSEC3PARAM 1 0 1 -" jp.out.ns3.$n > /dev/null || ret=1
428 # delayed adds and deletes.
429 grep "add nsec3param.test. 0 IN TYPE65534 .# 6 000180000500" jp.out.ns3.$n > /dev/null || ret=1
430 grep "add nsec3param.test. 0 IN TYPE65534 .# 6 000140000100" jp.out.ns3.$n > /dev/null || ret=1
431 grep "add nsec3param.test. 0 IN TYPE65534 .# 6 000140000400" jp.out.ns3.$n > /dev/null || ret=1
432 if [ $ret != 0 ] ; then echo "I: failed"; status=`expr $ret + $status`; fi
436 echo "I:testing that rndc stop updates the master file"
437 $NSUPDATE -k ns1/ddns.key <<END > /dev/null || ret=1
438 server 10.53.0.1 5300
439 update add updated4.example.nil. 600 A 10.10.10.3
440 send
442 $PERL $SYSTEMTESTTOP/stop.pl --use-rndc . ns1
443 # Removing the journal file and restarting the server means
444 # that the data served by the new server process are exactly
445 # those dumped to the master file by "rndc stop".
446 rm -f ns1/*jnl
447 $PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns1
448 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd updated4.example.nil.\
449 @10.53.0.1 a -p 5300 > dig.out.ns1 || status=1
450 $PERL ../digcomp.pl knowngood.ns1.afterstop dig.out.ns1 || ret=1
451 [ $ret = 0 ] || { echo I:failed; status=1; }
453 ret=0
454 echo "I:check that 'nsupdate -l' with a missing keyfile reports the missing file"
455 $NSUPDATE -l -p 5300 -k ns1/nonexistant.key 2> nsupdate.out < /dev/null
456 grep ns1/nonexistant.key nsupdate.out > /dev/null || ret=1
457 if test $ret -ne 0
458 then
459 echo "I:failed"; status=1
462 n=`expr $n + 1`
463 ret=0
464 echo "I:check that changes to the DNSKEY RRset TTL do not have side effects ($n)"
465 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd dnskey.test. \
466 @10.53.0.3 -p 5300 dnskey | \
467 sed -n 's/\(.*\)10.IN/update add \1600 IN/p' |
468 (echo server 10.53.0.3 5300; cat - ; echo send ) |
469 $NSUPDATE
471 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd dnskey.test. \
472 @10.53.0.3 -p 5300 any > dig.out.ns3.$n
474 grep "600.*DNSKEY" dig.out.ns3.$n > /dev/null || ret=1
475 grep TYPE65534 dig.out.ns3.$n > /dev/null && ret=1
476 if test $ret -ne 0
477 then
478 echo "I:failed"; status=1
481 n=`expr $n + 1`
482 ret=0
483 echo "I:check notify with TSIG worked ($n)"
484 # if the alternate view received a notify--meaning, the notify was
485 # validly signed by "altkey"--then the zonefile update.alt.bk will
486 # will have been created.
487 [ -f ns2/update.alt.bk ] || ret=1
488 if [ $ret -ne 0 ]; then
489 echo "I:failed"
490 status=1
493 n=`expr $n + 1`
494 ret=0
495 echo "I:check type list options ($n)"
496 $NSUPDATE -T > typelist.out.T.${n} || { ret=1; echo "I: nsupdate -T failed"; }
497 $NSUPDATE -P > typelist.out.P.${n} || { ret=1; echo "I: nsupdate -P failed"; }
498 $NSUPDATE -TP > typelist.out.TP.${n} || { ret=1; echo "I: nsupdate -TP failed"; }
499 grep ANY typelist.out.T.${n} > /dev/null && { ret=1; echo "I: failed: ANY found (-T)"; }
500 grep ANY typelist.out.P.${n} > /dev/null && { ret=1; echo "I: failed: ANY found (-P)"; }
501 grep ANY typelist.out.TP.${n} > /dev/null && { ret=1; echo "I: failed: ANY found (-TP)"; }
502 grep KEYDATA typelist.out.T.${n} > /dev/null && { ret=1; echo "I: failed: KEYDATA found (-T)"; }
503 grep KEYDATA typelist.out.P.${n} > /dev/null && { ret=1; echo "I: failed: KEYDATA found (-P)"; }
504 grep KEYDATA typelist.out.TP.${n} > /dev/null && { ret=1; echo "I: failed: KEYDATA found (-TP)"; }
505 grep AAAA typelist.out.T.${n} > /dev/null || { ret=1; echo "I: failed: AAAA not found (-T)"; }
506 grep AAAA typelist.out.P.${n} > /dev/null && { ret=1; echo "I: failed: AAAA found (-P)"; }
507 grep AAAA typelist.out.TP.${n} > /dev/null || { ret=1; echo "I: failed: AAAA not found (-TP)"; }
508 if [ $ret -ne 0 ]; then
509 echo "I:failed"
510 status=1
513 n=`expr $n + 1`
514 ret=0
515 echo "I:check command list ($n)"
517 while read cmd
519 echo "$cmd" | $NSUPDATE > /dev/null 2>&1
520 if test $? -gt 1 ; then
521 echo "I: failed ($cmd)"
522 ret=1
524 echo "$cmd " | $NSUPDATE > /dev/null 2>&1
525 if test $? -gt 1 ; then
526 echo "I: failed ($cmd)"
527 ret=1
529 done
530 exit $ret
531 ) < commandlist || ret=1
532 if [ $ret -ne 0 ]; then
533 status=1
536 n=`expr $n + 1`
537 ret=0
538 echo "I:check TSIG key algorithms ($n)"
539 for alg in md5 sha1 sha224 sha256 sha384 sha512; do
540 $NSUPDATE -k ns1/${alg}.key <<END > /dev/null || ret=1
541 server 10.53.0.1 5300
542 update add ${alg}.keytests.nil. 600 A 10.10.10.3
543 send
545 done
546 sleep 2
547 for alg in md5 sha1 sha224 sha256 sha384 sha512; do
548 $DIG +short @10.53.0.1 -p 5300 ${alg}.keytests.nil | grep 10.10.10.3 > /dev/null 2>&1 || ret=1
549 done
550 if [ $ret -ne 0 ]; then
551 echo "I:failed"
552 status=1
555 n=`expr $n + 1`
556 ret=0
557 echo "I:check that ttl is capped by max-ttl ($n)"
558 $NSUPDATE <<END > /dev/null || ret=1
559 server 10.53.0.1 5300
560 update add cap.max-ttl.nil. 600 A 10.10.10.3
561 update add nocap.max-ttl.nil. 150 A 10.10.10.3
562 send
564 sleep 2
565 $DIG @10.53.0.1 -p 5300 cap.max-ttl.nil | grep "^cap.max-ttl.nil. 300" > /dev/null 2>&1 || ret=1
566 $DIG @10.53.0.1 -p 5300 nocap.max-ttl.nil | grep "^nocap.max-ttl.nil. 150" > /dev/null 2>&1 || ret=1
567 if [ $ret -ne 0 ]; then
568 echo "I:failed"
569 status=1
572 n=`expr $n + 1`
573 ret=0
574 echo "I:add a record which is truncated when logged. ($n)"
575 $NSUPDATE verylarge || ret=1
576 $DIG +tcp @10.53.0.1 -p 5300 txt txt.update.nil > dig.out.ns1.test$n
577 grep "ANSWER: 1," dig.out.ns1.test$n > /dev/null || ret=1
578 grep "adding an RR at 'txt.update.nil' TXT .* \[TRUNCATED\]" ns1/named.run > /dev/null || ret=1
579 if [ $ret -ne 0 ]; then
580 echo "I:failed"
581 status=1
584 echo "I:exit status: $status"
585 exit $status