From 3f816cf4dda596cfaafc5c70d1dab12dce9523ef Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 15 Sep 2010 03:47:08 +0000 Subject: [PATCH] 2959. [func] Check that named starts with a missing masterfile. [RT #22076] --- CHANGES | 3 ++ bin/tests/system/masterfile/clean.sh | 4 +- bin/tests/system/masterfile/ns2/example.db | 26 +++++++++++ bin/tests/system/masterfile/ns2/named.conf | 51 ++++++++++++++++++++++ bin/tests/system/masterfile/tests.sh | 37 ++++++++++++---- 5 files changed, 111 insertions(+), 10 deletions(-) create mode 100644 bin/tests/system/masterfile/ns2/example.db create mode 100644 bin/tests/system/masterfile/ns2/named.conf diff --git a/CHANGES b/CHANGES index 68644d3d3f..452ffe22a1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2959. [func] Check that named starts with a missing masterfile. + [RT #22076] + 2957. [bug] entropy_get() and entropy_getpseudo() failed to match the API for RAND_bytes() and RAND_pseudo_bytes() respectively. [RT #21962] diff --git a/bin/tests/system/masterfile/clean.sh b/bin/tests/system/masterfile/clean.sh index d90a65dc67..9919580336 100644 --- a/bin/tests/system/masterfile/clean.sh +++ b/bin/tests/system/masterfile/clean.sh @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: clean.sh,v 1.5 2007/09/26 03:22:44 marka Exp $ +# $Id: clean.sh,v 1.5.250.1 2010/09/15 03:47:08 marka Exp $ -rm -f dig.out +rm -f dig.out.* rm -f */named.memstats diff --git a/bin/tests/system/masterfile/ns2/example.db b/bin/tests/system/masterfile/ns2/example.db new file mode 100644 index 0000000000..8a169efe5c --- /dev/null +++ b/bin/tests/system/masterfile/ns2/example.db @@ -0,0 +1,26 @@ +; Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC") +; +; Permission to use, copy, modify, and/or distribute this software for any +; purpose with or without fee is hereby granted, provided that the above +; copyright notice and this permission notice appear in all copies. +; +; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +; PERFORMANCE OF THIS SOFTWARE. + +; $Id: example.db,v 1.2.6.2 2010/09/15 03:47:08 marka Exp $ + +$TTL 300 ; 5 minutes +@ IN SOA mname1. . ( + 2010042407 ; serial + 20 ; refresh (20 seconds) + 20 ; retry (20 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) + NS ns2 +ns2 A 10.53.0.2 diff --git a/bin/tests/system/masterfile/ns2/named.conf b/bin/tests/system/masterfile/ns2/named.conf new file mode 100644 index 0000000000..31c9b7da14 --- /dev/null +++ b/bin/tests/system/masterfile/ns2/named.conf @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: named.conf,v 1.2.6.2 2010/09/15 03:47:08 marka Exp $ */ + +// NS2 + +controls { /* empty */ }; + +options { + query-source address 10.53.0.2; + notify-source 10.53.0.2; + transfer-source 10.53.0.2; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 { none; }; + recursion no; + notify yes; + dnssec-enable yes; + dnssec-validation yes; +}; + +zone "." { + type hint; + file "../../common/root.hint"; +}; + +zone "example" { + type master; + file "example.db"; +}; + +zone "missing" { + type master; + file "missing.db"; +}; + diff --git a/bin/tests/system/masterfile/tests.sh b/bin/tests/system/masterfile/tests.sh index beebcdca6a..02df10c44d 100644 --- a/bin/tests/system/masterfile/tests.sh +++ b/bin/tests/system/masterfile/tests.sh @@ -15,23 +15,44 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: tests.sh,v 1.5 2007/06/19 23:47:04 tbox Exp $ +# $Id: tests.sh,v 1.5.332.1 2010/09/15 03:47:08 marka Exp $ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 +n=0 -echo "I:test master file \$INCLUDE semantics" -$DIG +nostats +nocmd include. axfr @10.53.0.1 -p 5300 >dig.out +ret=0 +n=`expr $n + 1` +echo "I:test master file \$INCLUDE semantics ($n)" +$DIG +nostats +nocmd include. axfr @10.53.0.1 -p 5300 >dig.out.$n -echo "I:test master file BIND 8 compatibility TTL and \$TTL semantics" -$DIG +nostats +nocmd ttl2. axfr @10.53.0.1 -p 5300 >>dig.out +echo "I:test master file BIND 8 compatibility TTL and \$TTL semantics ($n)" +$DIG +nostats +nocmd ttl2. axfr @10.53.0.1 -p 5300 >>dig.out.$n -echo "I:test of master file RFC1035 TTL and \$TTL semantics" -$DIG +nostats +nocmd ttl2. axfr @10.53.0.1 -p 5300 >>dig.out +echo "I:test of master file RFC1035 TTL and \$TTL semantics ($n)" +$DIG +nostats +nocmd ttl2. axfr @10.53.0.1 -p 5300 >>dig.out.$n -diff dig.out knowngood.dig.out || status=1 +diff dig.out.$n knowngood.dig.out || status=1 +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + +ret=0 +n=`expr $n + 1` +echo "I:test that the nameserver is running with a missing master file ($n)" +$DIG +tcp +noall +answer example soa @10.53.0.2 -p 5300 > dig.out.$n +grep SOA dig.out.$n > /dev/null || ret=1 +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + +ret=0 +n=`expr $n + 1` +echo "I:test that the nameserver returns SERVFAIL for a missing master file ($n)" +$DIG +tcp +all missing soa @10.53.0.2 -p 5300 > dig.out.$n +grep "status: SERVFAIL" dig.out.$n > /dev/null || ret=1 +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` echo "I:exit status: $status" exit $status