1#!/bin/sh -x 2# 3# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4# 5# This Source Code Form is subject to the terms of the Mozilla Public 6# License, v. 2.0. If a copy of the MPL was not distributed with this 7# file, you can obtain one at https://mozilla.org/MPL/2.0/. 8# 9# See the COPYRIGHT file distributed with this work for additional 10# information regarding copyright ownership. 11 12# shellcheck source=conf.sh 13SYSTEMTESTTOP=.. 14. "$SYSTEMTESTTOP/conf.sh" 15 16dig_with_opts() { 17 "$DIG" -p "${PORT}" "$@" 18} 19 20rndccmd() ( 21 "$RNDC" -c "$SYSTEMTESTTOP/common/rndc.conf" -p "${CONTROLPORT}" -s "$@" 22) 23 24_wait_for_message() ( 25 nextpartpeek "$1" > wait_for_message.$n 26 grep -F "$2" wait_for_message.$n >/dev/null 27) 28 29wait_for_message() ( 30 retry_quiet 20 _wait_for_message "$@" 31) 32 33_wait_for_rcode() ( 34 rcode="$1" 35 qtype="$2" 36 ns="$3" 37 qname="$4" 38 file="$5" 39 shift 5 40 dig_with_opts "$ns" "$qtype" "$qname" "$@" >"$file" || return 1 41 grep "status: $rcode" "$file" >/dev/null 42) 43 44wait_for_rcode() ( 45 retry_quiet 10 _wait_for_rcode "$@" 46) 47 48wait_for_soa() ( 49 wait_for_rcode NOERROR SOA "$@" 50) 51 52wait_for_a() ( 53 wait_for_rcode NOERROR A "$@" 54) 55 56wait_for_no_soa() { 57 wait_for_rcode REFUSED SOA "$@" 58} 59 60_wait_for_zonefile() ( 61 # shellcheck disable=SC2234 62 [ -f "$1" ] 63) 64 65wait_for_zonefile() ( 66 retry_quiet 10 _wait_for_zonefile "$@" 67) 68 69_wait_for_no_zonefile() ( 70 # shellcheck disable=SC2234 71 [ ! -f "$1" ] 72) 73 74wait_for_no_zonefile() ( 75 retry_quiet 10 _wait_for_no_zonefile "$@" 76) 77 78status=0 79n=0 80########################################################################## 81echo_i "Testing adding/removing of domain in catalog zone" 82n=`expr $n + 1` 83echo_i "checking that dom1.example. is not served by master ($n)" 84ret=0 85wait_for_no_soa @10.53.0.1 dom1.example. dig.out.test$n || ret=1 86if [ $ret != 0 ]; then echo_i "failed"; fi 87status=`expr $status + $ret` 88 89n=`expr $n + 1` 90echo_i "Adding a domain dom1.example. to master via RNDC ($n)" 91ret=0 92echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom1.example.db 93echo "@ IN NS invalid." >> ns1/dom1.example.db 94rndccmd 10.53.0.1 addzone dom1.example. '{type master; file "dom1.example.db";};' || ret=1 95if [ $ret != 0 ]; then echo_i "failed"; fi 96status=`expr $status + $ret` 97 98n=`expr $n + 1` 99echo_i "checking that dom1.example. is now served by master ($n)" 100ret=0 101wait_for_soa @10.53.0.1 dom1.example. dig.out.test$n || ret=1 102if [ $ret != 0 ]; then echo_i "failed"; fi 103status=`expr $status + $ret` 104 105nextpart ns2/named.run >/dev/null 106 107n=`expr $n + 1` 108echo_i "Adding domain dom1.example. to catalog1 zone ($n)" 109ret=0 110$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 111 server 10.53.0.1 ${PORT} 112 update add e721433b6160b450260d4f54b3ec8bab30cb3b83.zones.catalog1.example. 3600 IN PTR dom1.example. 113 send 114END 115if [ $ret != 0 ]; then echo_i "failed"; fi 116status=`expr $status + $ret` 117 118n=`expr $n + 1` 119echo_i "waiting for slave to sync up ($n)" 120ret=0 121wait_for_message ns2/named.run "catz: adding zone 'dom1.example' from catalog 'catalog1.example'" && 122wait_for_message ns2/named.run "transfer of 'dom1.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 123if [ $ret != 0 ]; then echo_i "failed"; fi 124status=`expr $status + $ret` 125 126n=`expr $n + 1` 127echo_i "checking that dom1.example. is served by slave ($n)" 128ret=0 129wait_for_soa @10.53.0.2 dom1.example. dig.out.test$n || ret=1 130if [ $ret != 0 ]; then echo_i "failed"; fi 131status=`expr $status + $ret` 132 133n=`expr $n + 1` 134echo_i "checking that zone-directory is populated ($n)" 135ret=0 136wait_for_zonefile "ns2/zonedir/__catz___default_catalog1.example_dom1.example.db" || ret=1 137if [ $ret != 0 ]; then echo_i "failed"; fi 138status=`expr $status + $ret` 139 140n=`expr $n + 1` 141echo_i "removing domain dom1.example. from catalog1 zone ($n)" 142ret=0 143$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 144 server 10.53.0.1 ${PORT} 145 update delete e721433b6160b450260d4f54b3ec8bab30cb3b83.zones.catalog1.example 146 send 147END 148if [ $ret != 0 ]; then echo_i "failed"; fi 149status=`expr $status + $ret` 150 151n=`expr $n + 1` 152echo_i "waiting for slave to sync up ($n)" 153ret=0 154wait_for_message ns2/named.run "zone_shutdown: zone dom1.example/IN: shutting down" || ret=1 155if [ $ret != 0 ]; then echo_i "failed"; fi 156status=`expr $status + $ret` 157 158n=`expr $n + 1` 159echo_i "checking that dom1.example. is not served by slave ($n)" 160ret=0 161wait_for_no_soa @10.53.0.2 dom1.example. dig.out.test$n || ret=1 162if [ $ret != 0 ]; then echo_i "failed"; fi 163status=`expr $status + $ret` 164 165n=`expr $n + 1` 166echo_i "checking that zone-directory is emptied ($n)" 167ret=0 168wait_for_no_zonefile "ns2/zonedir/__catz___default_catalog1.example_dom1.example.db" || ret=1 169if [ $ret != 0 ]; then echo_i "failed"; fi 170status=`expr $status + $ret` 171 172########################################################################## 173echo_i "Testing various simple operations on domains, including using multiple catalog zones and garbage in zone" 174n=`expr $n + 1` 175echo_i "adding domain dom2.example. to master via RNDC ($n)" 176ret=0 177echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom2.example.db 178echo "@ IN NS invalid." >> ns1/dom2.example.db 179rndccmd 10.53.0.1 addzone dom2.example. '{type master; file "dom2.example.db";};' || ret=1 180if [ $ret != 0 ]; then echo_i "failed"; fi 181status=`expr $status + $ret` 182 183n=`expr $n + 1` 184echo_i "adding domain dom4.example. to master via RNDC ($n)" 185ret=0 186echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom4.example.db 187echo "@ IN NS invalid." >> ns1/dom4.example.db 188rndccmd 10.53.0.1 addzone dom4.example. '{type master; file "dom4.example.db";};' || ret=1 189if [ $ret != 0 ]; then echo_i "failed"; fi 190status=`expr $status + $ret` 191 192n=`expr $n + 1` 193echo_i "adding domains dom2.example, dom3.example. and some garbage to catalog1 zone ($n)" 194ret=0 195$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 196 server 10.53.0.1 ${PORT} 197 update add 636722929740e507aaf27c502812fc395d30fb17.zones.catalog1.example. 3600 IN PTR dom2.example. 198 update add b901f492f3ebf6c1e5b597e51766f02f0479eb03.zones.catalog1.example. 3600 IN PTR dom3.example. 199 update add e721433b6160b450260d4f54b3ec8bab30cb3b83.zones.catalog1.example. 3600 IN NS foo.bar. 200 update add trash.catalog1.example. 3600 IN A 1.2.3.4 201 update add trash2.foo.catalog1.example. 3600 IN A 1.2.3.4 202 update add trash3.zones.catalog1.example. 3600 IN NS a.dom2.example. 203 update add foobarbaz.b901f492f3ebf6c1e5b597e51766f02f0479eb03.zones.catalog1.example. 3600 IN PTR dom3.example. 204 update add blahblah.636722929740e507aaf27c502812fc395d30fb17.zones.catalog1.example. 3600 IN PTR dom2.example. 205 update add foobarbaz.b901f492f3ebf6c1e5b597e51766f02f0479eb03.zones.catalog1.example. 3600 IN APL 1:1.2.3.4/30 206 update add blahblah.636722929740e507aaf27c502812fc395d30fb17.zones.catalog1.example. 3600 IN TXT "blah blah" 207 update add version.catalog1.example. 3600 IN A 1.2.3.4 208 send 209 210END 211if [ $ret != 0 ]; then echo_i "failed"; fi 212status=`expr $status + $ret` 213 214n=`expr $n + 1` 215echo_i "adding domain dom4.example. to catalog2 zone ($n)" 216ret=0 217$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 218 server 10.53.0.3 ${PORT} 219 update add de26b88d855397a03f77ff1162fd055d8b419584.zones.catalog2.example. 3600 IN PTR dom4.example. 220 send 221END 222if [ $ret != 0 ]; then echo_i "failed"; fi 223status=`expr $status + $ret` 224 225 226n=`expr $n + 1` 227echo_i "waiting for slave to sync up ($n)" 228ret=0 229wait_for_message ns2/named.run "catz: adding zone 'dom4.example' from catalog 'catalog2.example'" && 230wait_for_message ns2/named.run "transfer of 'dom4.example/IN' from 10.53.0.1#${EXTRAPORT1}: Transfer status: success" || ret=1 231if [ $ret != 0 ]; then echo_i "failed"; fi 232status=`expr $status + $ret` 233 234n=`expr $n + 1` 235echo_i "checking that dom4.example. is served by slave ($n)" 236ret=0 237wait_for_soa @10.53.0.2 dom4.example. dig.out.test$n || ret=1 238if [ $ret != 0 ]; then echo_i "failed"; fi 239status=`expr $status + $ret` 240 241 242n=`expr $n + 1` 243echo_i "checking that dom3.example. is not served by master ($n)" 244ret=0 245wait_for_no_soa @10.53.0.1 dom3.example. dig.out.test$n || ret=1 246if [ $ret != 0 ]; then echo_i "failed"; fi 247status=`expr $status + $ret` 248 249n=`expr $n + 1` 250echo_i "adding a domain dom3.example. to master via RNDC ($n)" 251ret=0 252echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom3.example.db 253echo "@ IN NS invalid." >> ns1/dom3.example.db 254rndccmd 10.53.0.1 addzone dom3.example. '{type master; file "dom3.example.db"; also-notify { 10.53.0.2; }; notify explicit; };' || ret=1 255if [ $ret != 0 ]; then echo_i "failed"; fi 256status=`expr $status + $ret` 257 258n=`expr $n + 1` 259echo_i "checking that dom3.example. is served by master ($n)" 260ret=0 261wait_for_soa @10.53.0.1 dom3.example. dig.out.test$n || ret=1 262if [ $ret != 0 ]; then echo_i "failed"; fi 263status=`expr $status + $ret` 264 265n=`expr $n + 1` 266echo_i "waiting for slave to sync up ($n)" 267ret=0 268wait_for_message ns2/named.run "catz: adding zone 'dom2.example' from catalog 'catalog1.example'" && 269wait_for_message ns2/named.run "catz: adding zone 'dom3.example' from catalog 'catalog1.example'" && 270wait_for_message ns2/named.run "transfer of 'dom2.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" && 271wait_for_message ns2/named.run "transfer of 'dom3.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 272if [ $ret != 0 ]; then echo_i "failed"; fi 273status=`expr $status + $ret` 274 275n=`expr $n + 1` 276echo_i "checking that dom3.example. is served by slave ($n)" 277ret=0 278wait_for_soa @10.53.0.2 dom3.example. dig.out.test$n || ret=1 279if [ $ret != 0 ]; then echo_i "failed"; fi 280status=`expr $status + $ret` 281 282n=`expr $n + 1` 283echo_i "removing all records from catalog1 zone ($n)" 284ret=0 285$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 286 server 10.53.0.1 ${PORT} 287 update delete 636722929740e507aaf27c502812fc395d30fb17.zones.catalog1.example. 3600 IN PTR dom2.example. 288 update delete b901f492f3ebf6c1e5b597e51766f02f0479eb03.zones.catalog1.example. 3600 IN PTR dom3.example. 289 update delete e721433b6160b450260d4f54b3ec8bab30cb3b83.zones.catalog1.example. 3600 IN NS foo.bar. 290 update delete trash.catalog1.example. 3600 IN A 1.2.3.4 291 update delete trash2.foo.catalog1.example. 3600 IN A 1.2.3.4 292 update delete trash3.zones.catalog1.example. 3600 IN NS a.dom2.example. 293 update delete foobarbaz.b901f492f3ebf6c1e5b597e51766f02f0479eb03.zones.catalog1.example. 3600 IN PTR dom3.example. 294 update delete blahblah.636722929740e507aaf27c502812fc395d30fb17.zones.catalog1.example. 3600 IN PTR dom2.example. 295 update delete foobarbaz.b901f492f3ebf6c1e5b597e51766f02f0479eb03.zones.catalog1.example. 3600 IN APL 1:1.2.3.4/30 296 update delete blahblah.636722929740e507aaf27c502812fc395d30fb17.zones.catalog1.example. 3600 IN TXT "blah blah" 297 update delete version.catalog1.example. 3600 IN A 1.2.3.4 298 send 299 300END 301if [ $ret != 0 ]; then echo_i "failed"; fi 302status=`expr $status + $ret` 303 304n=`expr $n + 1` 305echo_i "removing all records from catalog2 zone ($n)" 306ret=0 307$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 308 server 10.53.0.3 ${PORT} 309 update delete de26b88d855397a03f77ff1162fd055d8b419584.zones.catalog2.example. 3600 IN PTR dom4.example. 310 send 311END 312if [ $ret != 0 ]; then echo_i "failed"; fi 313status=`expr $status + $ret` 314 315########################################################################## 316echo_i "Testing masters suboption and random labels" 317n=`expr $n + 1` 318echo_i "adding dom5.example. with a valid masters suboption (IP without TSIG) and a random label ($n)" 319ret=0 320$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 321 server 10.53.0.1 ${PORT} 322 update add somerandomlabel.zones.catalog1.example. 3600 IN PTR dom5.example. 323 update add masters.somerandomlabel.zones.catalog1.example. 3600 IN A 10.53.0.3 324 send 325END 326if [ $ret != 0 ]; then echo_i "failed"; fi 327status=`expr $status + $ret` 328 329n=`expr $n + 1` 330echo_i "waiting for slave to sync up ($n)" 331ret=0 332wait_for_message ns2/named.run "catz: adding zone 'dom5.example' from catalog 'catalog1.example'" && 333wait_for_message ns2/named.run "transfer of 'dom5.example/IN' from 10.53.0.3#${PORT}: Transfer status: success" || ret=1 334if [ $ret != 0 ]; then echo_i "failed"; fi 335status=`expr $status + $ret` 336 337n=`expr $n + 1` 338echo_i "checking that dom5.example. is served by slave ($n)" 339ret=0 340wait_for_soa @10.53.0.2 dom5.example. dig.out.test$n || ret=1 341if [ $ret != 0 ]; then echo_i "failed"; fi 342status=`expr $status + $ret` 343 344n=`expr $n + 1` 345echo_i "removing dom5.example. ($n)" 346ret=0 347$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 348 server 10.53.0.1 ${PORT} 349 update delete somerandomlabel.zones.catalog1.example. 3600 IN PTR dom5.example. 350 update delete masters.somerandomlabel.zones.catalog1.example. 3600 IN A 10.53.0.3 351 send 352END 353if [ $ret != 0 ]; then echo_i "failed"; fi 354status=`expr $status + $ret` 355 356n=`expr $n + 1` 357echo_i "waiting for slave to sync up ($n)" 358ret=0 359wait_for_message ns2/named.run "zone_shutdown: zone dom5.example/IN: shutting down" || ret=1 360if [ $ret != 0 ]; then echo_i "failed"; fi 361status=`expr $status + $ret` 362 363n=`expr $n + 1` 364echo_i "checking that dom5.example. is no longer served by slave ($n)" 365ret=0 366wait_for_no_soa @10.53.0.2 dom5.example. dig.out.test$n || ret=1 367if [ $ret != 0 ]; then echo_i "failed"; fi 368status=`expr $status + $ret` 369 370 371########################################################################## 372echo_i "Testing masters global option" 373n=`expr $n + 1` 374echo_i "adding dom6.example. and a valid global masters option (IP without TSIG) ($n)" 375ret=0 376$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 377 server 10.53.0.1 ${PORT} 378 update add masters.catalog1.example. 3600 IN A 10.53.0.3 379 update add masters.catalog1.example. 3600 IN AAAA fd92:7065:b8e:ffff::3 380 update add 4346f565b4d63ddb99e5d2497ff22d04e878e8f8.zones.catalog1.example. 3600 IN PTR dom6.example. 381 send 382END 383if [ $ret != 0 ]; then echo_i "failed"; fi 384status=`expr $status + $ret` 385 386n=`expr $n + 1` 387echo_i "waiting for slave to sync up ($n)" 388ret=0 389wait_for_message ns2/named.run "catz: adding zone 'dom6.example' from catalog 'catalog1.example'" && 390wait_for_message ns2/named.run "transfer of 'dom6.example/IN' from " > /dev/null || ret=1 391if [ $ret != 0 ]; then echo_i "failed"; fi 392status=`expr $status + $ret` 393 394n=`expr $n + 1` 395echo_i "checking that dom6.example. is served by slave ($n)" 396ret=0 397wait_for_soa @10.53.0.2 dom6.example. dig.out.test$n || ret=1 398if [ $ret != 0 ]; then echo_i "failed"; fi 399status=`expr $status + $ret` 400 401n=`expr $n + 1` 402echo_i "removing dom6.example. ($n)" 403ret=0 404$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 405 server 10.53.0.1 ${PORT} 406 update delete masters.catalog1.example. 3600 IN A 10.53.0.3 407 update delete masters.catalog1.example. 3600 IN AAAA fd92:7065:b8e:ffff::3 408 update delete 4346f565b4d63ddb99e5d2497ff22d04e878e8f8.zones.catalog1.example. 3600 IN PTR dom6.example. 409 send 410END 411if [ $ret != 0 ]; then echo_i "failed"; fi 412status=`expr $status + $ret` 413 414n=`expr $n + 1` 415echo_i "waiting for slave to sync up ($n)" 416ret=0 417wait_for_message ns2/named.run "zone_shutdown: zone dom6.example/IN: shutting down" || ret=1 418if [ $ret != 0 ]; then echo_i "failed"; fi 419status=`expr $status + $ret` 420 421n=`expr $n + 1` 422echo_i "checking that dom6.example. is no longer served by slave ($n)" 423ret=0 424wait_for_no_soa @10.53.0.2 dom6.example. dig.out.test$n || ret=1 425if [ $ret != 0 ]; then echo_i "failed"; fi 426status=`expr $status + $ret` 427 428nextpart ns2/named.run >/dev/null 429 430n=`expr $n + 1` 431echo_i "adding dom6.example. and an invalid global masters option (TSIG without IP) ($n)" 432ret=0 433$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 434 server 10.53.0.1 ${PORT} 435 update add label1.masters.catalog1.example. 3600 IN TXT "tsig_key" 436 update add 4346f565b4d63ddb99e5d2497ff22d04e878e8f8.zones.catalog1.example. 3600 IN PTR dom6.example. 437 send 438END 439if [ $ret != 0 ]; then echo_i "failed"; fi 440status=`expr $status + $ret` 441 442n=`expr $n + 1` 443echo_i "waiting for slave to sync up ($n)" 444ret=0 445wait_for_message ns2/named.run "catz: adding zone 'dom6.example' from catalog 'catalog1.example'" && 446wait_for_message ns2/named.run "error \"failure\" while trying to generate config for zone \"dom6.example\"" || ret=1 447if [ $ret != 0 ]; then echo_i "failed"; fi 448status=`expr $status + $ret` 449 450n=`expr $n + 1` 451echo_i "removing dom6.example. ($n)" 452ret=0 453$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 454 server 10.53.0.1 ${PORT} 455 update delete label1.masters.catalog1.example. 3600 IN TXT "tsig_key" 456 update delete 4346f565b4d63ddb99e5d2497ff22d04e878e8f8.zones.catalog1.example. 3600 IN PTR dom6.example. 457 send 458END 459if [ $ret != 0 ]; then echo_i "failed"; fi 460status=`expr $status + $ret` 461 462n=`expr $n + 1` 463echo_i "waiting for slave to sync up ($n)" 464ret=0 465wait_for_message ns2/named.run "catz: deleting zone 'dom6.example' from catalog 'catalog1.example' - success" > /dev/null || ret=1 466if [ $ret != 0 ]; then echo_i "failed"; fi 467status=`expr $status + $ret` 468 469########################################################################## 470n=`expr $n + 1` 471echo_i "Checking that a missing zone directory forces in-memory ($n)" 472ret=0 473grep "'nonexistent' not found; zone files will not be saved" ns2/named.run > /dev/null || ret=1 474if [ $ret != 0 ]; then echo_i "failed"; fi 475status=`expr $status + $ret` 476 477########################################################################## 478echo_i "Testing allow-query and allow-transfer ACLs" 479n=`expr $n + 1` 480echo_i "adding domains dom7.example. and dom8.example. to master via RNDC ($n)" 481ret=0 482echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom7.example.db 483echo "@ IN NS invalid." >> ns1/dom7.example.db 484rndccmd 10.53.0.1 addzone dom7.example. '{type master; file "dom7.example.db";};' || ret=1 485if [ $ret != 0 ]; then echo_i "failed"; fi 486status=`expr $status + $ret` 487echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom8.example.db 488echo "@ IN NS invalid." >> ns1/dom8.example.db 489rndccmd 10.53.0.1 addzone dom8.example. '{type master; file "dom8.example.db";};' || ret=1 490if [ $ret != 0 ]; then echo_i "failed"; fi 491status=`expr $status + $ret` 492 493n=`expr $n + 1` 494echo_i "checking that dom7.example. is now served by master ($n)" 495ret=0 496wait_for_soa @10.53.0.1 dom7.example. dig.out.test$n || ret=1 497if [ $ret != 0 ]; then echo_i "failed"; fi 498status=`expr $status + $ret` 499 500nextpart ns2/named.run >/dev/null 501 502n=`expr $n + 1` 503echo_i "adding domain dom7.example. to catalog1 zone with an allow-query statement ($n)" 504ret=0 505$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 506 server 10.53.0.1 ${PORT} 507 update add 78833ec3c0059fd4540fee81c7eaddce088e7cd7.zones.catalog1.example. 3600 IN PTR dom7.example. 508 update add allow-query.78833ec3c0059fd4540fee81c7eaddce088e7cd7.zones.catalog1.example. 3600 IN APL 1:10.53.0.1/32 !1:10.53.0.0/30 1:0.0.0.0/0 509 send 510END 511if [ $ret != 0 ]; then echo_i "failed"; fi 512status=`expr $status + $ret` 513 514n=`expr $n + 1` 515echo_i "waiting for slave to sync up ($n)" 516ret=0 517wait_for_message ns2/named.run "catz: adding zone 'dom7.example' from catalog 'catalog1.example'" > /dev/null && 518wait_for_message ns2/named.run "transfer of 'dom7.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 519if [ $ret != 0 ]; then echo_i "failed"; fi 520status=`expr $status + $ret` 521 522n=`expr $n + 1` 523echo_i "checking that dom7.example. is accessible from 10.53.0.1 ($n)" 524ret=0 525wait_for_soa @10.53.0.2 dom7.example. dig.out.test$n -b 10.53.0.1 || ret=1 526if [ $ret != 0 ]; then echo_i "failed"; fi 527status=`expr $status + $ret` 528 529n=`expr $n + 1` 530echo_i "checking that dom7.example. is not accessible from 10.53.0.2 ($n)" 531ret=0 532wait_for_no_soa @10.53.0.2 dom7.example. dig.out.test$n -b 10.53.0.2 || ret=1 533if [ $ret != 0 ]; then echo_i "failed"; fi 534status=`expr $status + $ret` 535 536n=`expr $n + 1` 537echo_i "checking that dom7.example. is accessible from 10.53.0.5 ($n)" 538ret=0 539wait_for_soa @10.53.0.2 dom7.example. dig.out.test$n -b 10.53.0.5 || ret=1 540if [ $ret != 0 ]; then echo_i "failed"; fi 541status=`expr $status + $ret` 542 543nextpart ns2/named.run >/dev/null 544n=`expr $n + 1` 545echo_i "adding dom8.example. domain and global allow-query and allow-transfer ACLs ($n)" 546ret=0 547$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 548 server 10.53.0.1 ${PORT} 549 update add cba95222e308baba42417be6021026fdf20827b6.zones.catalog1.example. 3600 IN PTR dom8.example 550 update add allow-query.catalog1.example. 3600 IN APL 1:10.53.0.1/32 551 update add allow-transfer.catalog1.example. 3600 IN APL 1:10.53.0.2/32 552 send 553END 554if [ $ret != 0 ]; then echo_i "failed"; fi 555status=`expr $status + $ret` 556 557n=`expr $n + 1` 558echo_i "waiting for slave to sync up ($n)" 559ret=0 560wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 561if [ $ret != 0 ]; then echo_i "failed"; fi 562status=`expr $status + $ret` 563 564n=`expr $n + 1` 565echo_i "checking that dom8.example. is accessible from 10.53.0.1 ($n)" 566ret=0 567wait_for_soa @10.53.0.2 dom8.example. dig.out.test$n -b 10.53.0.1 || ret=1 568if [ $ret != 0 ]; then echo_i "failed"; fi 569status=`expr $status + $ret` 570 571n=`expr $n + 1` 572echo_i "checking that dom8.example. is not accessible from 10.53.0.2 ($n)" 573ret=0 574wait_for_no_soa @10.53.0.2 dom8.example. dig.out.test$n -b 10.53.0.2 || ret=1 575if [ $ret != 0 ]; then echo_i "failed"; fi 576status=`expr $status + $ret` 577 578n=`expr $n + 1` 579echo_i "checking that dom8.example. is not AXFR accessible from 10.53.0.1 ($n)" 580ret=0 581dig_with_opts @10.53.0.2 axfr dom8.example. -b 10.53.0.1 > dig.out.test$n 582grep "Transfer failed." dig.out.test$n > /dev/null || ret=1 583if [ $ret != 0 ]; then echo_i "failed"; fi 584status=`expr $status + $ret` 585 586n=`expr $n + 1` 587echo_i "checking that dom8.example. is AXFR accessible from 10.53.0.2 ($n)" 588ret=0 589dig_with_opts @10.53.0.2 axfr dom8.example. -b 10.53.0.2 > dig.out.test$n 590grep -v "Transfer failed." dig.out.test$n > /dev/null || ret=1 591if [ $ret != 0 ]; then echo_i "failed"; fi 592status=`expr $status + $ret` 593 594nextpart ns2/named.run >/dev/null 595n=`expr $n + 1` 596echo_i "deleting global allow-query and allow-domain ACLs ($n)" 597ret=0 598$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 599 server 10.53.0.1 ${PORT} 600 update delete allow-query.catalog1.example. 3600 IN APL 1:10.53.0.1/32 601 update delete allow-transfer.catalog1.example. 3600 IN APL 1:10.53.0.2/32 602 send 603END 604if [ $ret != 0 ]; then echo_i "failed"; fi 605status=`expr $status + $ret` 606ret=0 607wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 608if [ $ret != 0 ]; then echo_i "failed"; fi 609status=`expr $status + $ret` 610 611n=`expr $n + 1` 612echo_i "checking that dom8.example. is accessible from 10.53.0.1 ($n)" 613ret=0 614wait_for_soa @10.53.0.2 dom8.example. dig.out.test$n -b 10.53.0.1 || ret=1 615if [ $ret != 0 ]; then echo_i "failed"; fi 616status=`expr $status + $ret` 617 618n=`expr $n + 1` 619echo_i "checking that dom8.example. is accessible from 10.53.0.2 ($n)" 620ret=0 621wait_for_soa @10.53.0.2 dom8.example. dig.out.test$n -b 10.53.0.2 || ret=1 622if [ $ret != 0 ]; then echo_i "failed"; fi 623status=`expr $status + $ret` 624 625n=`expr $n + 1` 626echo_i "checking that dom8.example. is AXFR accessible from 10.53.0.1 ($n)" 627ret=0 628dig_with_opts @10.53.0.2 axfr dom8.example. -b 10.53.0.1 > dig.out.test$n 629grep -v "Transfer failed." dig.out.test$n > /dev/null || ret=1 630if [ $ret != 0 ]; then echo_i "failed"; fi 631status=`expr $status + $ret` 632 633n=`expr $n + 1` 634echo_i "checking that dom8.example. is AXFR accessible from 10.53.0.2 ($n)" 635ret=0 636dig_with_opts @10.53.0.2 axfr dom8.example. -b 10.53.0.2 > dig.out.test$n 637grep -v "Transfer failed." dig.out.test$n > /dev/null || ret=1 638if [ $ret != 0 ]; then echo_i "failed"; fi 639status=`expr $status + $ret` 640 641 642########################################################################## 643echo_i "Testing TSIG keys for masters set per-domain" 644n=`expr $n + 1` 645echo_i "adding a domain dom9.example. to master via RNDC, with transfers allowed only with TSIG key ($n)" 646ret=0 647echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom9.example.db 648echo "@ IN NS invalid." >> ns1/dom9.example.db 649rndccmd 10.53.0.1 addzone dom9.example. '{type master; file "dom9.example.db"; allow-transfer { key tsig_key; }; };' || ret=1 650if [ $ret != 0 ]; then echo_i "failed"; fi 651status=`expr $status + $ret` 652 653n=`expr $n + 1` 654echo_i "checking that dom9.example. is now served by master ($n)" 655ret=0 656wait_for_soa @10.53.0.1 dom9.example. dig.out.test$n || ret=1 657if [ $ret != 0 ]; then echo_i "failed"; fi 658status=`expr $status + $ret` 659 660nextpart ns2/named.run >/dev/null 661 662n=`expr $n + 1` 663echo_i "adding domain dom9.example. to catalog1 zone with a valid masters suboption (IP with TSIG) ($n)" 664ret=0 665$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 666 server 10.53.0.1 ${PORT} 667 update add f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN PTR dom9.example. 668 update add label1.masters.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN A 10.53.0.1 669 update add label1.masters.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN TXT "tsig_key" 670 send 671END 672if [ $ret != 0 ]; then echo_i "failed"; fi 673status=`expr $status + $ret` 674 675n=`expr $n + 1` 676echo_i "waiting for slave to sync up ($n)" 677ret=0 678wait_for_message ns2/named.run "catz: adding zone 'dom9.example' from catalog 'catalog1.example'" && 679wait_for_message ns2/named.run "transfer of 'dom9.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 680if [ $ret != 0 ]; then echo_i "failed"; fi 681status=`expr $status + $ret` 682 683n=`expr $n + 1` 684echo_i "checking that dom9.example. is accessible on slave ($n)" 685ret=0 686wait_for_soa @10.53.0.2 dom9.example. dig.out.test$n || ret=1 687if [ $ret != 0 ]; then echo_i "failed"; fi 688status=`expr $status + $ret` 689 690n=`expr $n + 1` 691echo_i "deleting domain dom9.example. from catalog1 zone ($n)" 692ret=0 693$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 694 server 10.53.0.1 ${PORT} 695 update delete f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN PTR dom9.example. 696 update delete label1.masters.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN A 10.53.0.1 697 update delete label1.masters.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN TXT "tsig_key" 698 send 699END 700if [ $ret != 0 ]; then echo_i "failed"; fi 701status=`expr $status + $ret` 702 703n=`expr $n + 1` 704echo_i "waiting for slave to sync up ($n)" 705ret=0 706wait_for_message ns2/named.run "catz: deleting zone 'dom9.example' from catalog 'catalog1.example' - success" || ret=1 707if [ $ret != 0 ]; then echo_i "failed"; fi 708status=`expr $status + $ret` 709 710n=`expr $n + 1` 711echo_i "checking that dom9.example. is no longer accessible on slave ($n)" 712ret=0 713wait_for_no_soa @10.53.0.2 dom9.example. dig.out.test$n || ret=1 714if [ $ret != 0 ]; then echo_i "failed"; fi 715status=`expr $status + $ret` 716 717nextpart ns2/named.run >/dev/null 718 719n=`expr $n + 1` 720echo_i "adding domain dom9.example. to catalog1 zone with an invalid masters suboption (TSIG without IP) ($n)" 721ret=0 722$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 723 server 10.53.0.1 ${PORT} 724 update add f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN PTR dom9.example. 725 update add label1.masters.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN TXT "tsig_key" 726 send 727END 728if [ $ret != 0 ]; then echo_i "failed"; fi 729status=`expr $status + $ret` 730 731n=`expr $n + 1` 732echo_i "waiting for slave to sync up ($n)" 733ret=0 734wait_for_message ns2/named.run "catz: adding zone 'dom9.example' from catalog 'catalog1.example'" && 735wait_for_message ns2/named.run "error \"failure\" while trying to generate config for zone \"dom9.example\"" || ret=1 736if [ $ret != 0 ]; then echo_i "failed"; fi 737status=`expr $status + $ret` 738 739n=`expr $n + 1` 740echo_i "deleting domain dom9.example. from catalog1 zone ($n)" 741ret=0 742$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 743 server 10.53.0.1 ${PORT} 744 update delete f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN PTR dom9.example. 745 update delete label1.masters.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN TXT "tsig_key" 746 send 747END 748if [ $ret != 0 ]; then echo_i "failed"; fi 749status=`expr $status + $ret` 750 751n=`expr $n + 1` 752echo_i "waiting for slave to sync up ($n)" 753ret=0 754wait_for_message ns2/named.run "catz: deleting zone 'dom9.example' from catalog 'catalog1.example'" || ret=1 755if [ $ret != 0 ]; then echo_i "failed"; fi 756status=`expr $status + $ret` 757 758########################################################################## 759echo_i "Testing catalog entries that can't be represented as filenames" 760# note: we need 4 backslashes in the shell to get 2 backslashes in DNS 761# presentation format, which is 1 backslash on the wire. 762for special in \ 763 this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example \ 764 this.zone/domain.has.a.slash.dom10.example \ 765 this.zone\\\\domain.has.backslash.dom10.example \ 766 this.zone:domain.has.a.colon.dom.10.example 767do 768 # hashes below are generated by: 769 # python ${TOP}/contrib/scripts/catzhash.py "${special}" 770 771 case "$special" in 772 this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example) 773 hash=825f48b1ce1b4cf5a041d20255a0c8e98d114858 774 db=__catz__4d70696f2335687069467f11f5d5378c480383f97782e553fb2d04a7bb2a23ed.db 775 ;; 776 this.zone/domain.has.a.slash.dom10.example) 777 hash=e64cc64c99bf52d0a77fb16dd7ed57cf925a36aa 778 db=__catz__46ba3e1b28d5955e5313d5fee61bedc78c71d08035aa7ea2f7bf0b8228ab3acc.db 779 ;; 780 this.zone\\\\domain.has.backslash.dom10.example) 781 hash=91e27e02153d38cf656a9b376d7747fbcd19f985 782 db=__catz__b667f7ff802c0895e0506699951cff9a1cab68c5ef8546aa0d07425f244ed870.db 783 ;; 784 this.zone:domain.has.a.colon.dom.10.example) 785 hash=8b7238bf4c34045834c573ba4116557ebb24d33c 786 db=__catz__5c721f7872913a4e7fa8ad42589cce5dd6e551a4c9e6ab3f86e77c0bbc7c2ca6.db 787 ;; 788 esac 789 790 n=`expr $n + 1` 791 echo_i "checking that ${special}. is not served by master ($n)" 792 ret=0 793 wait_for_no_soa @10.53.0.1 "${special}" dig.out.test$n || ret=1 794 if [ $ret -ne 0 ]; then echo_i "failed"; fi 795 status=`expr $status + $ret` 796 797 n=`expr $n + 1` 798 echo_i "Adding a domain ${special}. to master via RNDC ($n)" 799 ret=0 800 echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom10.example.db 801 echo "@ IN NS invalid." >> ns1/dom10.example.db 802 rndccmd 10.53.0.1 addzone '"'"${special}"'"' '{type master; file "dom10.example.db";};' || ret=1 803 if [ $ret -ne 0 ]; then echo_i "failed"; fi 804 status=`expr $status + $ret` 805 806 n=`expr $n + 1` 807 echo_i "checking that ${special}. is now served by master ($n)" 808 ret=0 809 wait_for_soa @10.53.0.1 "${special}." dig.out.test$n || ret=1 810 if [ $ret -ne 0 ]; then echo_i "failed"; fi 811 status=`expr $status + $ret` 812 813 nextpart ns2/named.run >/dev/null 814 815 n=`expr $n + 1` 816 echo_i "Adding domain ${special}. to catalog1 zone ($n)" 817 ret=0 818 $NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 819 server 10.53.0.1 ${PORT} 820 update add ${hash}.zones.catalog1.example 3600 IN PTR ${special}. 821 send 822END 823 if [ $ret -ne 0 ]; then echo_i "failed"; fi 824 status=`expr $status + $ret` 825 826 n=`expr $n + 1` 827 echo_i "waiting for slave to sync up ($n)" 828 ret=0 829 wait_for_message ns2/named.run "catz: adding zone '$special' from catalog 'catalog1.example'" && 830 wait_for_message ns2/named.run "transfer of '$special/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 831 if [ $ret -ne 0 ]; then echo_i "failed"; fi 832 status=`expr $status + $ret` 833 834 n=`expr $n + 1` 835 echo_i "checking that ${special}. is served by slave ($n)" 836 ret=0 837 wait_for_soa @10.53.0.2 "${special}." dig.out.test$n || ret=1 838 if [ $ret -ne 0 ]; then echo_i "failed"; fi 839 status=`expr $status + $ret` 840 841 n=`expr $n + 1` 842 echo_i "checking that zone-directory is populated with a hashed filename ($n)" 843 ret=0 844 wait_for_zonefile "ns2/zonedir/$db" || ret=1 845 if [ $ret -ne 0 ]; then echo_i "failed"; fi 846 status=`expr $status + $ret` 847 848 n=`expr $n + 1` 849 echo_i "removing domain ${special}. from catalog1 zone ($n)" 850 ret=0 851 $NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 852 server 10.53.0.1 ${PORT} 853 update delete ${hash}.zones.catalog1.example 854 send 855END 856 if [ $ret -ne 0 ]; then echo_i "failed"; fi 857 status=`expr $status + $ret` 858 859 n=`expr $n + 1` 860 echo_i "waiting for slave to sync up ($n)" 861 ret=0 862 wait_for_message ns2/named.run "zone_shutdown: zone ${special}/IN: shutting down" || ret=1 863 if [ $ret -ne 0 ]; then echo_i "failed"; fi 864 status=`expr $status + $ret` 865 866 n=`expr $n + 1` 867 echo_i "checking that ${special}. is not served by slave ($n)" 868 ret=0 869 wait_for_no_soa @10.53.0.2 "${special}." dig.out.test$n || ret=1 870 if [ $ret -ne 0 ]; then echo_i "failed"; fi 871 status=`expr $status + $ret` 872 873 n=`expr $n + 1` 874 echo_i "checking that zone-directory is emptied ($n)" 875 ret=0 876 wait_for_no_zonefile "ns2/zonedir/$db" || ret=1 877 if [ $ret -ne 0 ]; then echo_i "failed"; fi 878 status=`expr $status + $ret` 879done 880 881########################################################################## 882echo_i "Testing adding a domain and a subdomain of it" 883n=`expr $n + 1` 884echo_i "checking that dom11.example. is not served by master ($n)" 885ret=0 886wait_for_no_soa @10.53.0.1 dom11.example. dig.out.test$n || ret=1 887if [ $ret != 0 ]; then echo_i "failed"; fi 888status=`expr $status + $ret` 889 890n=`expr $n + 1` 891echo_i "Adding a domain dom11.example. to master via RNDC ($n)" 892ret=0 893echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom11.example.db 894echo "@ IN NS invalid." >> ns1/dom11.example.db 895rndccmd 10.53.0.1 addzone dom11.example. '{type master; file "dom11.example.db";};' || ret=1 896if [ $ret != 0 ]; then echo_i "failed"; fi 897status=`expr $status + $ret` 898 899n=`expr $n + 1` 900echo_i "checking that dom11.example. is now served by master ($n)" 901ret=0 902wait_for_soa @10.53.0.1 dom11.example. dig.out.test$n || ret=1 903if [ $ret != 0 ]; then echo_i "failed"; fi 904status=`expr $status + $ret` 905 906nextpart ns2/named.run >/dev/null 907 908n=`expr $n + 1` 909echo_i "Adding domain dom11.example. to catalog1 zone ($n)" 910ret=0 911$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 912 server 10.53.0.1 ${PORT} 913 update add 0580d70e769c86c8b951a488d8b776627f427d7a.zones.catalog1.example. 3600 IN PTR dom11.example. 914 send 915END 916if [ $ret != 0 ]; then echo_i "failed"; fi 917status=`expr $status + $ret` 918 919n=`expr $n + 1` 920echo_i "waiting for slave to sync up ($n)" 921ret=0 922wait_for_message ns2/named.run "catz: adding zone 'dom11.example' from catalog 'catalog1.example'" && 923wait_for_message ns2/named.run "transfer of 'dom11.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 924if [ $ret != 0 ]; then echo_i "failed"; fi 925status=`expr $status + $ret` 926 927n=`expr $n + 1` 928echo_i "checking that dom11.example. is served by slave ($n)" 929ret=0 930wait_for_soa @10.53.0.2 dom11.example. dig.out.test$n || ret=1 931if [ $ret != 0 ]; then echo_i "failed"; fi 932status=`expr $status + $ret` 933 934n=`expr $n + 1` 935echo_i "checking that subdomain.of.dom11.example. is not served by master ($n)" 936ret=0 937wait_for_rcode NXDOMAIN SOA @10.53.0.1 subdomain.of.dom11.example. dig.out.test$n || ret=1 938if [ $ret != 0 ]; then echo_i "failed"; fi 939status=`expr $status + $ret` 940 941n=`expr $n + 1` 942echo_i "Adding a domain subdomain.of.dom11.example. to master via RNDC ($n)" 943ret=0 944echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/subdomain.of.dom11.example.db 945echo "@ IN NS invalid." >> ns1/subdomain.of.dom11.example.db 946rndccmd 10.53.0.1 addzone subdomain.of.dom11.example. '{type master; file "subdomain.of.dom11.example.db";};' || ret=1 947if [ $ret != 0 ]; then echo_i "failed"; fi 948status=`expr $status + $ret` 949 950n=`expr $n + 1` 951echo_i "checking that subdomain.of.dom11.example. is now served by master ($n)" 952ret=0 953wait_for_soa @10.53.0.1 subdomain.of.dom11.example. dig.out.test$n || ret=1 954if [ $ret != 0 ]; then echo_i "failed"; fi 955status=`expr $status + $ret` 956 957nextpart ns2/named.run >/dev/null 958 959n=`expr $n + 1` 960echo_i "Adding domain subdomain.of.dom11.example. to catalog1 zone ($n)" 961ret=0 962$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 963 server 10.53.0.1 ${PORT} 964 update add 25557e0bdd10cb3710199bb421b776df160f241e.zones.catalog1.example. 3600 IN PTR subdomain.of.dom11.example. 965 send 966END 967if [ $ret != 0 ]; then echo_i "failed"; fi 968status=`expr $status + $ret` 969 970n=`expr $n + 1` 971echo_i "waiting for slave to sync up ($n)" 972ret=0 973wait_for_message ns2/named.run "catz: adding zone 'subdomain.of.dom11.example' from catalog 'catalog1.example'" && 974wait_for_message ns2/named.run "transfer of 'subdomain.of.dom11.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 975if [ $ret != 0 ]; then echo_i "failed"; fi 976status=`expr $status + $ret` 977 978n=`expr $n + 1` 979echo_i "checking that subdomain.of.dom11.example. is served by slave ($n)" 980ret=0 981wait_for_soa @10.53.0.2 subdomain.of.dom11.example. dig.out.test$n || ret=1 982if [ $ret != 0 ]; then echo_i "failed"; fi 983status=`expr $status + $ret` 984n=`expr $n + 1` 985echo_i "removing domain dom11.example. from catalog1 zone ($n)" 986ret=0 987$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 988 server 10.53.0.1 ${PORT} 989 update delete 0580d70e769c86c8b951a488d8b776627f427d7a.zones.catalog1.example 990 send 991END 992if [ $ret != 0 ]; then echo_i "failed"; fi 993status=`expr $status + $ret` 994 995n=`expr $n + 1` 996echo_i "waiting for slave to sync up ($n)" 997ret=0 998wait_for_message ns2/named.run "zone_shutdown: zone dom11.example/IN: shutting down" || ret=1 999if [ $ret != 0 ]; then echo_i "failed"; fi 1000status=`expr $status + $ret` 1001 1002n=`expr $n + 1` 1003echo_i "checking that dom11.example. is not served by slave ($n)" 1004ret=0 1005wait_for_no_soa @10.53.0.2 dom11.example. dig.out.test$n || ret=1 1006if [ $ret != 0 ]; then echo_i "failed"; fi 1007status=`expr $status + $ret` 1008 1009n=`expr $n + 1` 1010echo_i "checking that subdomain.of.dom11.example. is still served by slave ($n)" 1011ret=0 1012wait_for_soa @10.53.0.2 subdomain.of.dom11.example. dig.out.test$n || ret=1 1013if [ $ret != 0 ]; then echo_i "failed"; fi 1014status=`expr $status + $ret` 1015 1016n=`expr $n + 1` 1017echo_i "removing domain subdomain.of.dom11.example. from catalog1 zone ($n)" 1018ret=0 1019$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1020 server 10.53.0.1 ${PORT} 1021 update delete 25557e0bdd10cb3710199bb421b776df160f241e.zones.catalog1.example 1022 send 1023END 1024if [ $ret != 0 ]; then echo_i "failed"; fi 1025status=`expr $status + $ret` 1026 1027n=`expr $n + 1` 1028echo_i "waiting for slave to sync up ($n)" 1029ret=0 1030wait_for_message ns2/named.run "zone_shutdown: zone subdomain.of.dom11.example/IN: shutting down" || ret=1 1031if [ $ret != 0 ]; then echo_i "failed"; fi 1032status=`expr $status + $ret` 1033 1034n=`expr $n + 1` 1035echo_i "checking that subdomain.of.dom11.example. is not served by slave ($n)" 1036ret=0 1037wait_for_no_soa @10.53.0.2 subdomain.of.d11.example. dig.out.test$n || ret=1 1038if [ $ret != 0 ]; then echo_i "failed"; fi 1039status=`expr $status + $ret` 1040 1041########################################################################## 1042echo_i "Testing adding a catalog zone at runtime with rndc reconfig" 1043n=`expr $n + 1` 1044echo_i "checking that dom12.example. is not served by master ($n)" 1045ret=0 1046wait_for_no_soa @10.53.0.1 dom12.example. dig.out.test$n || ret=1 1047if [ $ret != 0 ]; then echo_i "failed"; fi 1048status=`expr $status + $ret` 1049 1050n=`expr $n + 1` 1051echo_i "Adding a domain dom12.example. to master via RNDC ($n)" 1052ret=0 1053echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom12.example.db 1054echo "@ IN NS invalid." >> ns1/dom12.example.db 1055rndccmd 10.53.0.1 addzone dom12.example. '{type master; file "dom12.example.db";};' || ret=1 1056if [ $ret != 0 ]; then echo_i "failed"; fi 1057status=`expr $status + $ret` 1058 1059n=`expr $n + 1` 1060echo_i "checking that dom12.example. is now served by master ($n)" 1061ret=0 1062wait_for_soa @10.53.0.1 dom12.example. dig.out.test$n || ret=1 1063if [ $ret != 0 ]; then echo_i "failed"; fi 1064status=`expr $status + $ret` 1065 1066nextpart ns2/named.run >/dev/null 1067 1068n=`expr $n + 1` 1069echo_i "Adding domain dom12.example. to catalog4 zone ($n)" 1070ret=0 1071$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1072 server 10.53.0.1 ${PORT} 1073 update add 871d51e5433543c0f6fb263c40f359fbc152c8ae.zones.catalog4.example. 3600 IN PTR dom12.example. 1074 send 1075END 1076if [ $ret != 0 ]; then echo_i "failed"; fi 1077status=`expr $status + $ret` 1078 1079n=`expr $n + 1` 1080echo_i "checking that dom12.example. is not served by slave ($n)" 1081ret=0 1082wait_for_no_soa @10.53.0.2 dom12.example. dig.out.test$n || ret=1 1083if [ $ret != 0 ]; then echo_i "failed"; fi 1084status=`expr $status + $ret` 1085 1086 1087n=`expr $n + 1` 1088echo_i "reconfiguring slave - adding catalog4 catalog zone ($n)" 1089ret=0 1090sed -e "s/^#T1//g" < ns2/named.conf.in > ns2/named.conf.tmp 1091copy_setports ns2/named.conf.tmp ns2/named.conf 1092rndccmd 10.53.0.2 reconfig || ret=1 1093if [ $ret != 0 ]; then echo_i "failed"; fi 1094status=`expr $status + $ret` 1095 1096n=`expr $n + 1` 1097echo_i "waiting for slave to sync up ($n)" 1098ret=0 1099wait_for_message ns2/named.run "catz: adding zone 'dom12.example' from catalog 'catalog4.example'" && 1100wait_for_message ns2/named.run "transfer of 'dom12.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 1101if [ $ret != 0 ]; then echo_i "failed"; fi 1102status=`expr $status + $ret` 1103 1104n=`expr $n + 1` 1105echo_i "checking that dom7.example. is still served by slave after reconfiguration ($n)" 1106ret=0 1107wait_for_soa @10.53.0.2 dom7.example. dig.out.test$n -b 10.53.0.1 || ret=1 1108if [ $ret != 0 ]; then echo_i "failed"; fi 1109status=`expr $status + $ret` 1110n=`expr $n + 1` 1111 1112echo_i "checking that dom12.example. is served by slave ($n)" 1113ret=0 1114wait_for_soa @10.53.0.2 dom12.example. dig.out.test$n || ret=1 1115if [ $ret != 0 ]; then echo_i "failed"; fi 1116status=`expr $status + $ret` 1117 1118n=`expr $n + 1` 1119echo_i "reconfiguring slave - removing catalog4 catalog zone, adding non-existent catalog5 catalog zone ($n)" 1120ret=0 1121sed -e "s/^#T2//" < ns2/named.conf.in > ns2/named.conf.tmp 1122copy_setports ns2/named.conf.tmp ns2/named.conf 1123$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reconfig > /dev/null 2>&1 && ret=1 1124if [ $ret != 0 ]; then echo_i "failed"; fi 1125status=`expr $status + $ret` 1126 1127n=`expr $n + 1` 1128echo_i "reconfiguring slave - removing non-existent catalog5 catalog zone ($n)" 1129ret=0 1130copy_setports ns2/named.conf.in ns2/named.conf 1131rndccmd 10.53.0.2 reconfig || ret=1 1132if [ $ret != 0 ]; then echo_i "failed"; fi 1133status=`expr $status + $ret` 1134 1135n=`expr $n + 1` 1136echo_i "checking that dom12.example. is not served by slave ($n)" 1137ret=0 1138wait_for_no_soa @10.53.0.2 dom12.example. dig.out.test$n || ret=1 1139if [ $ret != 0 ]; then echo_i "failed"; fi 1140status=`expr $status + $ret` 1141 1142n=`expr $n + 1` 1143echo_i "removing domain dom12.example. from catalog4 zone ($n)" 1144ret=0 1145$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1146 server 10.53.0.1 ${PORT} 1147 update delete 871d51e5433543c0f6fb263c40f359fbc152c8ae.zones.catalog4.example. 3600 IN PTR dom12.example. 1148 send 1149END 1150if [ $ret != 0 ]; then echo_i "failed"; fi 1151status=`expr $status + $ret` 1152 1153########################################################################## 1154echo_i "Testing having a zone in two different catalogs" 1155n=`expr $n + 1` 1156echo_i "checking that dom13.example. is not served by master ($n)" 1157ret=0 1158wait_for_no_soa @10.53.0.1 dom13.example. dig.out.test$n || ret=1 1159if [ $ret != 0 ]; then echo_i "failed"; fi 1160status=`expr $status + $ret` 1161 1162n=`expr $n + 1` 1163echo_i "Adding a domain dom13.example. to master ns1 via RNDC ($n)" 1164ret=0 1165echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom13.example.db 1166echo "@ IN NS invalid." >> ns1/dom13.example.db 1167echo "@ IN A 192.0.2.1" >> ns1/dom13.example.db 1168rndccmd 10.53.0.1 addzone dom13.example. '{type master; file "dom13.example.db";};' || ret=1 1169if [ $ret != 0 ]; then echo_i "failed"; fi 1170status=`expr $status + $ret` 1171 1172n=`expr $n + 1` 1173echo_i "checking that dom13.example. is now served by master ns1 ($n)" 1174ret=0 1175wait_for_soa @10.53.0.1 dom13.example. dig.out.test$n || ret=1 1176if [ $ret != 0 ]; then echo_i "failed"; fi 1177status=`expr $status + $ret` 1178 1179n=`expr $n + 1` 1180echo_i "Adding a domain dom13.example. to master ns3 via RNDC ($n)" 1181ret=0 1182echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns3/dom13.example.db 1183echo "@ IN NS invalid." >> ns3/dom13.example.db 1184echo "@ IN A 192.0.2.2" >> ns3/dom13.example.db 1185rndccmd 10.53.0.3 addzone dom13.example. '{type master; file "dom13.example.db";};' || ret=1 1186if [ $ret != 0 ]; then echo_i "failed"; fi 1187status=`expr $status + $ret` 1188 1189n=`expr $n + 1` 1190echo_i "checking that dom13.example. is now served by master ns3 ($n)" 1191ret=0 1192wait_for_soa @10.53.0.3 dom13.example. dig.out.test$n || ret=1 1193if [ $ret != 0 ]; then echo_i "failed"; fi 1194status=`expr $status + $ret` 1195 1196 1197nextpart ns2/named.run >/dev/null 1198 1199n=`expr $n + 1` 1200echo_i "Adding domain dom13.example. to catalog1 zone with ns1 as master ($n)" 1201ret=0 1202$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1203 server 10.53.0.1 ${PORT} 1204 update add 8d7989c746b3f92b3bba2479e72afd977198363f.zones.catalog1.example. 3600 IN PTR dom13.example. 1205 update add masters.8d7989c746b3f92b3bba2479e72afd977198363f.zones.catalog1.example. 3600 IN A 10.53.0.1 1206 send 1207END 1208if [ $ret != 0 ]; then echo_i "failed"; fi 1209status=`expr $status + $ret` 1210 1211n=`expr $n + 1` 1212echo_i "waiting for slave to sync up ($n)" 1213ret=0 1214wait_for_message ns2/named.run "catz: adding zone 'dom13.example' from catalog 'catalog1.example'" && 1215wait_for_message ns2/named.run "transfer of 'dom13.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 1216if [ $ret != 0 ]; then echo_i "failed"; fi 1217status=`expr $status + $ret` 1218 1219nextpart ns2/named.run >/dev/null 1220 1221n=`expr $n + 1` 1222echo_i "checking that dom13.example. is served by slave and that it's the one from ns1 ($n)" 1223ret=0 1224wait_for_a @10.53.0.2 dom13.example. dig.out.test$n || ret=1 1225grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1 1226if [ $ret != 0 ]; then echo_i "failed"; fi 1227status=`expr $status + $ret` 1228 1229n=`expr $n + 1` 1230echo_i "Adding domain dom13.example. to catalog2 zone with ns3 as master ($n)" 1231ret=0 1232$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1233 server 10.53.0.3 ${PORT} 1234 update add 8d7989c746b3f92b3bba2479e72afd977198363f.zones.catalog2.example. 3600 IN PTR dom13.example. 1235 update add masters.8d7989c746b3f92b3bba2479e72afd977198363f.zones.catalog2.example. 3600 IN A 10.53.0.3 1236 send 1237END 1238if [ $ret != 0 ]; then echo_i "failed"; fi 1239status=`expr $status + $ret` 1240 1241n=`expr $n + 1` 1242echo_i "waiting for slave to sync up ($n)" 1243ret=0 1244wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 1245if [ $ret != 0 ]; then echo_i "failed"; fi 1246status=`expr $status + $ret` 1247 1248n=`expr $n + 1` 1249echo_i "checking that dom13.example. is served by slave and that it's still the one from ns1 ($n)" 1250ret=0 1251wait_for_a @10.53.0.2 dom13.example. dig.out.test$n || ret=1 1252grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1 1253if [ $ret != 0 ]; then echo_i "failed"; fi 1254status=`expr $status + $ret` 1255 1256nextpart ns2/named.run >/dev/null 1257 1258n=`expr $n + 1` 1259echo_i "Deleting domain dom13.example. from catalog2 ($n)" 1260ret=0 1261$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1262 server 10.53.0.3 ${PORT} 1263 update delete 8d7989c746b3f92b3bba2479e72afd977198363f.zones.catalog2.example. 3600 IN PTR dom13.example. 1264 update delete masters.8d7989c746b3f92b3bba2479e72afd977198363f.zones.catalog2.example. 3600 IN A 10.53.0.3 1265 send 1266END 1267if [ $ret != 0 ]; then echo_i "failed"; fi 1268status=`expr $status + $ret` 1269 1270n=`expr $n + 1` 1271echo_i "waiting for slave to sync up ($n)" 1272ret=0 1273wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 1274if [ $ret != 0 ]; then echo_i "failed"; fi 1275status=`expr $status + $ret` 1276 1277n=`expr $n + 1` 1278echo_i "checking that dom13.example. is served by slave and that it's still the one from ns1 ($n)" 1279ret=0 1280wait_for_a @10.53.0.2 dom13.example. dig.out.test$n || ret=1 1281grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1 1282if [ $ret != 0 ]; then echo_i "failed"; fi 1283status=`expr $status + $ret` 1284 1285n=`expr $n + 1` 1286echo_i "Deleting domain dom13.example. from catalog1 ($n)" 1287ret=0 1288$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1289 server 10.53.0.1 ${PORT} 1290 update delete 8d7989c746b3f92b3bba2479e72afd977198363f.zones.catalog1.example. 3600 IN PTR dom13.example. 1291 update delete masters.8d7989c746b3f92b3bba2479e72afd977198363f.zones.catalog1.example. 3600 IN A 10.53.0.2 1292 send 1293END 1294if [ $ret != 0 ]; then echo_i "failed"; fi 1295status=`expr $status + $ret` 1296 1297n=`expr $n + 1` 1298echo_i "waiting for slave to sync up ($n)" 1299ret=0 1300wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 1301if [ $ret != 0 ]; then echo_i "failed"; fi 1302status=`expr $status + $ret` 1303 1304n=`expr $n + 1` 1305echo_i "checking that dom13.example. is no longer served by slave ($n)" 1306ret=0 1307wait_for_no_soa @10.53.0.2 dom13.example. dig.out.test$n || ret=1 1308if [ $ret != 0 ]; then echo_i "failed"; fi 1309status=`expr $status + $ret` 1310 1311########################################################################## 1312echo_i "Testing having a regular zone and a zone in catalog zone of the same name" 1313n=`expr $n + 1` 1314echo_i "checking that dom14.example. is not served by master ($n)" 1315ret=0 1316wait_for_no_soa @10.53.0.1 dom14.example. dig.out.test$n || ret=1 1317if [ $ret != 0 ]; then echo_i "failed"; fi 1318status=`expr $status + $ret` 1319 1320n=`expr $n + 1` 1321echo_i "Adding a domain dom14.example. to master ns1 via RNDC ($n)" 1322ret=0 1323echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom14.example.db 1324echo "@ IN NS invalid." >> ns1/dom14.example.db 1325echo "@ IN A 192.0.2.1" >> ns1/dom14.example.db 1326rndccmd 10.53.0.1 addzone dom14.example. '{type master; file "dom14.example.db";};' || ret=1 1327if [ $ret != 0 ]; then echo_i "failed"; fi 1328status=`expr $status + $ret` 1329 1330n=`expr $n + 1` 1331echo_i "checking that dom14.example. is now served by master ns1 ($n)" 1332ret=0 1333wait_for_soa @10.53.0.1 dom14.example. dig.out.test$n || ret=1 1334if [ $ret != 0 ]; then echo_i "failed"; fi 1335status=`expr $status + $ret` 1336 1337n=`expr $n + 1` 1338echo_i "Adding a domain dom14.example. to master ns3 via RNDC ($n)" 1339ret=0 1340echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns3/dom14.example.db 1341echo "@ IN NS invalid." >> ns3/dom14.example.db 1342echo "@ IN A 192.0.2.2" >> ns3/dom14.example.db 1343rndccmd 10.53.0.3 addzone dom14.example. '{type master; file "dom14.example.db";};' || ret=1 1344if [ $ret != 0 ]; then echo_i "failed"; fi 1345status=`expr $status + $ret` 1346 1347n=`expr $n + 1` 1348echo_i "checking that dom14.example. is now served by master ns3 ($n)" 1349ret=0 1350wait_for_soa @10.53.0.3 dom14.example. dig.out.test$n || ret=1 1351if [ $ret != 0 ]; then echo_i "failed"; fi 1352status=`expr $status + $ret` 1353 1354nextpart ns2/named.run >/dev/null 1355 1356n=`expr $n + 1` 1357echo_i "Adding domain dom14.example. with rndc with ns1 as master ($n)" 1358ret=0 1359rndccmd 10.53.0.2 addzone dom14.example. '{type slave; masters {10.53.0.1;};};' || ret=1 1360if [ $ret != 0 ]; then echo_i "failed"; fi 1361status=`expr $status + $ret` 1362 1363n=`expr $n + 1` 1364echo_i "waiting for slave to sync up ($n)" 1365ret=0 1366wait_for_message ns2/named.run "transfer of 'dom14.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1 1367if [ $ret != 0 ]; then echo_i "failed"; fi 1368status=`expr $status + $ret` 1369 1370nextpart ns2/named.run >/dev/null 1371 1372n=`expr $n + 1` 1373echo_i "checking that dom14.example. is served by slave and that it's the one from ns1 ($n)" 1374ret=0 1375wait_for_a @10.53.0.2 dom14.example. dig.out.test$n || ret=1 1376grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1 1377if [ $ret != 0 ]; then echo_i "failed"; fi 1378status=`expr $status + $ret` 1379 1380n=`expr $n + 1` 1381echo_i "Adding domain dom14.example. to catalog2 zone with ns3 as master ($n)" 1382ret=0 1383$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1384 server 10.53.0.3 ${PORT} 1385 update add 45e3d45ea5f7bd01c395ccbde6ae2e750a3ee8ab.zones.catalog2.example. 3600 IN PTR dom14.example. 1386 update add masters.45e3d45ea5f7bd01c395ccbde6ae2e750a3ee8ab.zones.catalog2.example. 3600 IN A 10.53.0.3 1387 send 1388END 1389if [ $ret != 0 ]; then echo_i "failed"; fi 1390status=`expr $status + $ret` 1391 1392n=`expr $n + 1` 1393echo_i "waiting for slave to sync up ($n)" 1394ret=0 1395wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 1396if [ $ret != 0 ]; then echo_i "failed"; fi 1397status=`expr $status + $ret` 1398 1399n=`expr $n + 1` 1400echo_i "checking that dom14.example. is served by slave and that it's still the one from ns1 ($n)" 1401ret=0 1402wait_for_a @10.53.0.2 dom14.example. dig.out.test$n || ret=1 1403grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1 1404if [ $ret != 0 ]; then echo_i "failed"; fi 1405status=`expr $status + $ret` 1406 1407nextpart ns2/named.run >/dev/null 1408 1409n=`expr $n + 1` 1410echo_i "Deleting domain dom14.example. from catalog2 ($n)" 1411ret=0 1412$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1413 server 10.53.0.3 ${PORT} 1414 update delete 45e3d45ea5f7bd01c395ccbde6ae2e750a3ee8ab.zones.catalog2.example. 3600 IN PTR dom14.example. 1415 update delete masters.45e3d45ea5f7bd01c395ccbde6ae2e750a3ee8ab.zones.catalog2.example. 3600 IN A 10.53.0.3 1416 send 1417END 1418if [ $ret != 0 ]; then echo_i "failed"; fi 1419status=`expr $status + $ret` 1420 1421n=`expr $n + 1` 1422echo_i "waiting for slave to sync up ($n)" 1423ret=0 1424wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 1425if [ $ret != 0 ]; then echo_i "failed"; fi 1426status=`expr $status + $ret` 1427 1428n=`expr $n + 1` 1429echo_i "checking that dom14.example. is served by slave and that it's still the one from ns1 ($n)" 1430ret=0 1431wait_for_a @10.53.0.2 dom14.example. dig.out.test$n || ret=1 1432grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1 1433if [ $ret != 0 ]; then echo_i "failed"; fi 1434status=`expr $status + $ret` 1435 1436########################################################################## 1437echo_i "Testing changing label for a member zone" 1438n=`expr $n + 1` 1439echo_i "checking that dom15.example. is not served by master ($n)" 1440ret=0 1441wait_for_no_soa @10.53.0.1 dom15.example. dig.out.test$n || ret=1 1442if [ $ret != 0 ]; then echo_i "failed"; fi 1443status=`expr $status + $ret` 1444 1445n=`expr $n + 1` 1446echo_i "Adding a domain dom15.example. to master ns1 via RNDC ($n)" 1447ret=0 1448echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom15.example.db 1449echo "@ IN NS invalid." >> ns1/dom15.example.db 1450rndccmd 10.53.0.1 addzone dom15.example. '{type master; file "dom15.example.db";};' || ret=1 1451if [ $ret != 0 ]; then echo_i "failed"; fi 1452status=`expr $status + $ret` 1453 1454n=`expr $n + 1` 1455echo_i "checking that dom15.example. is now served by master ns1 ($n)" 1456ret=0 1457wait_for_soa @10.53.0.1 dom15.example. dig.out.test$n || ret=1 1458if [ $ret != 0 ]; then echo_i "failed"; fi 1459status=`expr $status + $ret` 1460 1461nextpart ns2/named.run >/dev/null 1462 1463echo_i "Adding domain dom15.example. to catalog1 zone with 'dom15label1' label ($n)" 1464ret=0 1465$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1466 server 10.53.0.1 ${PORT} 1467 update add dom15label1.zones.catalog1.example. 3600 IN PTR dom15.example. 1468 send 1469END 1470if [ $ret != 0 ]; then echo_i "failed"; fi 1471status=`expr $status + $ret` 1472 1473n=`expr $n + 1` 1474echo_i "waiting for slave to sync up ($n)" 1475ret=0 1476wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 1477if [ $ret != 0 ]; then echo_i "failed"; fi 1478status=`expr $status + $ret` 1479 1480sleep 3 1481 1482n=`expr $n + 1` 1483echo_i "checking that dom15.example. is served by slave ($n)" 1484ret=0 1485wait_for_soa @10.53.0.2 dom15.example. dig.out.test$n || ret=1 1486if [ $ret != 0 ]; then echo_i "failed"; fi 1487status=`expr $status + $ret` 1488 1489nextpart ns2/named.run >/dev/null 1490 1491n=`expr $n + 1` 1492echo_i "Changing label of domain dom15.example. from 'dom15label1' to 'dom15label2' ($n)" 1493ret=0 1494$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1 1495 server 10.53.0.1 ${PORT} 1496 update delete dom15label1.zones.catalog1.example. 3600 IN PTR dom15.example. 1497 update add dom15label2.zones.catalog1.example. 3600 IN PTR dom15.example. 1498 send 1499END 1500if [ $ret != 0 ]; then echo_i "failed"; fi 1501status=`expr $status + $ret` 1502 1503n=`expr $n + 1` 1504echo_i "waiting for slave to sync up ($n)" 1505ret=0 1506wait_for_message ns2/named.run "catz: update_from_db: new zone merged" || ret=1 1507if [ $ret != 0 ]; then echo_i "failed"; fi 1508status=`expr $status + $ret` 1509 1510n=`expr $n + 1` 1511echo_i "checking that dom15.example. is served by slave ($n)" 1512ret=0 1513wait_for_soa @10.53.0.2 dom15.example. dig.out.test$n || ret=1 1514if [ $ret != 0 ]; then echo_i "failed"; fi 1515status=`expr $status + $ret` 1516 1517echo_i "exit status: $status" 1518[ $status -eq 0 ] || exit 1 1519