1#!/bin/sh 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 http://mozilla.org/MPL/2.0/. 8# 9# See the COPYRIGHT file distributed with this work for additional 10# information regarding copyright ownership. 11 12SYSTEMTESTTOP=.. 13. $SYSTEMTESTTOP/conf.sh 14 15DIGOPTS="+tcp +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" 16 17status=0 18n=0 19 20n=`expr $n + 1` 21echo_i "waiting for zone transfer to complete ($n)" 22ret=0 23for i in 1 2 3 4 5 6 7 8 9 24do 25 $DIG $DIGOPTS soa example. @10.53.0.2 > dig.ns2.test$n 26 grep SOA dig.ns2.test$n > /dev/null && break 27 sleep 1 28done 29for i in 1 2 3 4 5 6 7 8 9 30do 31 $DIG $DIGOPTS soa dynamic. @10.53.0.2 > dig.ns2.test$n 32 grep SOA dig.ns2.test$n > /dev/null && break 33 sleep 1 34done 35 36n=`expr $n + 1` 37echo_i "testing case preserving responses - no acl ($n)" 38ret=0 39$DIG $DIGOPTS mx example. @10.53.0.1 > dig.ns1.test$n 40grep "0.mail.eXaMpLe" dig.ns1.test$n > /dev/null || ret=1 41grep "mAiL.example" dig.ns1.test$n > /dev/null || ret=1 42test $ret -eq 0 || echo_i "failed" 43status=`expr $status + $ret` 44 45n=`expr $n + 1` 46echo_i "testing no-case-compress acl '{ 10.53.0.2; }' ($n)" 47ret=0 48 49# check that we preserve zone case for non-matching query (10.53.0.1) 50$DIG $DIGOPTS mx example. -b 10.53.0.1 @10.53.0.1 > dig.ns1.test$n 51grep "0.mail.eXaMpLe" dig.ns1.test$n > /dev/null || ret=1 52grep "mAiL.example" dig.ns1.test$n > /dev/null || ret=1 53 54# check that we don't preserve zone case for match (10.53.0.2) 55$DIG $DIGOPTS mx example. -b 10.53.0.2 @10.53.0.2 > dig.ns2.test$n 56grep "0.mail.example" dig.ns2.test$n > /dev/null || ret=1 57grep "mail.example" dig.ns2.test$n > /dev/null || ret=1 58 59test $ret -eq 0 || echo_i "failed" 60status=`expr $status + $ret` 61 62n=`expr $n + 1` 63echo_i "testing load of dynamic zone with various \$ORIGIN values ($n)" 64ret=0 65$DIG $DIGOPTS axfr dynamic @10.53.0.1 > dig.ns1.test$n 66digcomp dig.ns1.test$n dynamic.good || ret=1 67 68test $ret -eq 0 || echo_i "failed" 69status=`expr $status + $ret` 70 71n=`expr $n + 1` 72echo_i "transfer of dynamic zone with various \$ORIGIN values ($n)" 73ret=0 74$DIG $DIGOPTS axfr dynamic @10.53.0.2 > dig.ns2.test$n 75digcomp dig.ns2.test$n dynamic.good || ret=1 76 77test $ret -eq 0 || echo_i "failed" 78status=`expr $status + $ret` 79 80n=`expr $n + 1` 81echo_i "change SOA owner case via update ($n)" 82$NSUPDATE << EOF 83server 10.53.0.1 ${PORT} 84zone dynamic 85update add dYNAMIc 0 SOA mname1. . 2000042408 20 20 1814400 3600 86send 87EOF 88$DIG $DIGOPTS axfr dynamic @10.53.0.1 > dig.ns1.test$n 89digcomp dig.ns1.test$n postupdate.good || ret=1 90 91test $ret -eq 0 || echo_i "failed" 92status=`expr $status + $ret` 93 94for i in 1 2 3 4 5 6 7 8 9 95do 96 $DIG $DIGOPTS soa dynamic @10.53.0.2 | grep 2000042408 > /dev/null && break 97 sleep 1 98done 99 100n=`expr $n + 1` 101echo_i "check SOA owner case is transfered to slave ($n)" 102ret=0 103$DIG $DIGOPTS axfr dynamic @10.53.0.2 > dig.ns2.test$n 104digcomp dig.ns2.test$n postupdate.good || ret=1 105 106test $ret -eq 0 || echo_i "failed" 107status=`expr $status + $ret` 108 109#update delete Ns1.DyNaMIC. 300 IN A 10.53.0.1 110n=`expr $n + 1` 111echo_i "change A record owner case via update ($n)" 112$NSUPDATE << EOF 113server 10.53.0.1 ${PORT} 114zone dynamic 115update add Ns1.DyNaMIC. 300 IN A 10.53.0.1 116send 117EOF 118$DIG $DIGOPTS axfr dynamic @10.53.0.1 > dig.ns1.test$n 119digcomp dig.ns1.test$n postns1.good || ret=1 120 121test $ret -eq 0 || echo_i "failed" 122status=`expr $status + $ret` 123 124for i in 1 2 3 4 5 6 7 8 9 125do 126 $DIG $DIGOPTS soa dynamic @10.53.0.2 | grep 2000042409 > /dev/null && break 127 sleep 1 128done 129 130n=`expr $n + 1` 131echo_i "check A owner case is transfered to slave ($n)" 132ret=0 133$DIG $DIGOPTS axfr dynamic @10.53.0.2 > dig.ns2.test$n 134digcomp dig.ns2.test$n postns1.good || ret=1 135status=`expr $status + $ret` 136 137echo_i "exit status: $status" 138[ $status -eq 0 ] || exit 1 139