1#!/bin/sh 2# 3# Copyright (C) 2004, 2007, 2011-2013 Internet Systems Consortium, Inc. ("ISC") 4# Copyright (C) 2000, 2001 Internet Software Consortium. 5# 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. 9# 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. 17 18# Id: tests.sh,v 1.16 2011/11/02 23:46:24 tbox Exp 19 20SYSTEMTESTTOP=.. 21. $SYSTEMTESTTOP/conf.sh 22 23status=0 24echo "I:check that the stub zone has been saved to disk" 25for i in 1 2 3 4 5 6 7 8 9 20 26do 27 [ -f ns3/child.example.st ] && break 28 sleep 1 29done 30[ -f ns3/child.example.st ] || { status=1; echo "I:failed"; } 31 32for pass in 1 2 33do 34 35echo "I:trying an axfr that should be denied (NOTAUTH) (pass=$pass)" 36ret=0 37$DIG +tcp child.example. @10.53.0.3 axfr -p 5300 > dig.out.ns3 || ret=1 38grep "; Transfer failed." dig.out.ns3 > /dev/null || ret=1 39[ $ret = 0 ] || { status=1; echo "I:failed"; } 40 41echo "I:look for stub zone data without recursion (should not be found) (pass=$pass)" 42for i in 1 2 3 4 5 6 7 8 9 43do 44 ret=0 45 $DIG +tcp +norec data.child.example. \ 46 @10.53.0.3 txt -p 5300 > dig.out.ns3 || ret=1 47 grep "status: NOERROR" dig.out.ns3 > /dev/null || ret=1 48 [ $ret = 0 ] && break 49 sleep 1 50done 51$PERL ../digcomp.pl knowngood.dig.out.norec dig.out.ns3 || ret=1 52[ $ret = 0 ] || { status=1; echo "I:failed"; } 53 54echo "I:look for stub zone data with recursion (should be found) (pass=$pass)" 55ret=0 56$DIG +tcp +noauth +noadd data.child.example. @10.53.0.3 txt -p 5300 > dig.out.ns3 || ret=1 57$PERL ../digcomp.pl knowngood.dig.out.rec dig.out.ns3 || ret=1 58[ $ret = 0 ] || { status=1; echo "I:failed"; } 59 60[ $pass = 1 ] && { 61 echo "I:stopping stub server" 62 $PERL $SYSTEMTESTTOP/stop.pl . ns3 63 64 echo "I:re-starting stub server" 65 $PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns3 66} 67done 68 69echo "I:exit status: $status" 70exit $status 71