mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-25 02:42:33 -05:00
2036. [bug] Check built-in zone arguments to see if the zone
is re-usable or not. [RT #21914]
This commit is contained in:
parent
d967b49681
commit
e009a9de75
8 changed files with 216 additions and 19 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
2036. [bug] Check built-in zone arguments to see if the zone
|
||||
is re-usable or not. [RT #21914]
|
||||
|
||||
3035. [cleanup] Simplify by using strlcpy. [RT #22521]
|
||||
|
||||
3034. [cleanup] nslookup: use strlcpy instead of safecopy. [RT #22521]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# $Id: conf.sh.in,v 1.43.8.10 2010/12/07 03:01:37 marka Exp $
|
||||
# $Id: conf.sh.in,v 1.43.8.11 2011/02/22 04:30:45 marka Exp $
|
||||
|
||||
#
|
||||
# Common configuration data for system tests, to be sourced into
|
||||
|
|
@ -53,10 +53,11 @@ JOURNALPRINT=$TOP/bin/tools/named-journalprint
|
|||
# load on the machine to make it unusable to other users.
|
||||
# v6synth
|
||||
SUBDIRS="acl allow_query addzone autosign cacheclean checkconf checknames
|
||||
dlv @DLZ_SYSTEM_TEST@ dnssec forward glue ixfr limits lwresd
|
||||
masterfile masterformat metadata notify nsupdate pending pkcs11
|
||||
resolver rrsetorder sortlist smartsign stub tkey unknown upforwd
|
||||
views xfer xferquota zonechecks"
|
||||
database dlv @DLZ_SYSTEM_TEST@ dnssec forward glue
|
||||
ixfr limits lwresd masterfile masterformat metadata
|
||||
notify nsupdate pending pkcs11 resolver rrsetorder
|
||||
sortlist smartsign stub tkey unknown upforwd
|
||||
views xfer xferquota zonechecks"
|
||||
|
||||
# PERL will be an empty string if no perl interpreter was found.
|
||||
PERL=@PERL@
|
||||
|
|
|
|||
20
bin/tests/system/database/clean.sh
Normal file
20
bin/tests/system/database/clean.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 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: clean.sh,v 1.2.4.2 2011/02/22 04:30:45 marka Exp $
|
||||
|
||||
rm -f ns1/named.conf ns1/named.run ns1/named.memstats
|
||||
rm -f dig.out.*
|
||||
47
bin/tests/system/database/ns1/named.conf1
Normal file
47
bin/tests/system/database/ns1/named.conf1
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.conf1,v 1.2.4.2 2011/02/22 04:30:46 marka Exp $ */
|
||||
|
||||
// NS1
|
||||
|
||||
key rndc_key {
|
||||
secret "1234abcd8765";
|
||||
algorithm hmac-md5;
|
||||
};
|
||||
|
||||
controls {
|
||||
inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
|
||||
};
|
||||
|
||||
options {
|
||||
query-source address 10.53.0.1;
|
||||
notify-source 10.53.0.1;
|
||||
transfer-source 10.53.0.1;
|
||||
port 5300;
|
||||
pid-file "named.pid";
|
||||
listen-on { 10.53.0.1; };
|
||||
listen-on-v6 { none; };
|
||||
recursion no;
|
||||
notify yes;
|
||||
dnssec-enable yes;
|
||||
dnssec-validation yes;
|
||||
};
|
||||
|
||||
zone "database" {
|
||||
type master;
|
||||
database "_builtin empty localhost. hostmaster.isc.org.";
|
||||
};
|
||||
47
bin/tests/system/database/ns1/named.conf2
Normal file
47
bin/tests/system/database/ns1/named.conf2
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.conf2,v 1.2.4.2 2011/02/22 04:30:46 marka Exp $ */
|
||||
|
||||
// NS1
|
||||
|
||||
key rndc_key {
|
||||
secret "1234abcd8765";
|
||||
algorithm hmac-md5;
|
||||
};
|
||||
|
||||
controls {
|
||||
inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
|
||||
};
|
||||
|
||||
options {
|
||||
query-source address 10.53.0.1;
|
||||
notify-source 10.53.0.1;
|
||||
transfer-source 10.53.0.1;
|
||||
port 5300;
|
||||
pid-file "named.pid";
|
||||
listen-on { 10.53.0.1; };
|
||||
listen-on-v6 { none; };
|
||||
recursion no;
|
||||
notify yes;
|
||||
dnssec-enable yes;
|
||||
dnssec-validation yes;
|
||||
};
|
||||
|
||||
zone "database" {
|
||||
type master;
|
||||
database "_builtin empty localhost. marka.isc.org.";
|
||||
};
|
||||
19
bin/tests/system/database/setup.sh
Normal file
19
bin/tests/system/database/setup.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 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: setup.sh,v 1.2.4.2 2011/02/22 04:30:45 marka Exp $
|
||||
|
||||
cp ns1/named.conf1 ns1/named.conf
|
||||
60
bin/tests/system/database/tests.sh
Normal file
60
bin/tests/system/database/tests.sh
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 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: tests.sh,v 1.2.4.2 2011/02/22 04:30:45 marka Exp $
|
||||
|
||||
SYSTEMTESTTOP=..
|
||||
. $SYSTEMTESTTOP/conf.sh
|
||||
|
||||
status=0
|
||||
n=0
|
||||
|
||||
rm -f dig.out.*
|
||||
|
||||
DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p 5300"
|
||||
RNDCCMD="$RNDC -s 10.53.0.1 -p 9953 -c ../common/rndc.conf"
|
||||
|
||||
# Check the example. domain
|
||||
|
||||
echo "I:checking pre reload zone ($n)"
|
||||
ret=0
|
||||
$DIG $DIGOPTS soa database. @10.53.0.1 > dig.out.ns1.test$n || ret=1
|
||||
grep "hostmaster\.isc\.org" dig.out.ns1.test$n > /dev/null || ret=1
|
||||
n=`expr $n + 1`
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
cp ns1/named.conf2 ns1/named.conf
|
||||
$RNDCCMD reload 2>&1 >/dev/null
|
||||
|
||||
echo "I:checking post reload zone ($n)"
|
||||
ret=1
|
||||
try=0
|
||||
while test $try -lt 6
|
||||
do
|
||||
sleep 1
|
||||
ret=0
|
||||
$DIG $DIGOPTS soa database. @10.53.0.1 > dig.out.ns1.test$n || ret=1
|
||||
grep "marka\.isc\.org" dig.out.ns1.test$n > /dev/null || ret=1
|
||||
try=`expr $try + 1`
|
||||
test $ret -eq 0 && break
|
||||
done
|
||||
n=`expr $n + 1`
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
echo "I:exit status: $status"
|
||||
exit $status
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zone.c,v 1.540.2.45 2011/02/19 00:46:45 each Exp $ */
|
||||
/* $Id: zone.c,v 1.540.2.46 2011/02/22 04:30:46 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
|
|
@ -1373,6 +1373,7 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
|
|||
isc_time_t now;
|
||||
isc_time_t loadtime, filetime;
|
||||
dns_db_t *db = NULL;
|
||||
isc_boolean_t rbt;
|
||||
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
|
||||
|
|
@ -1388,14 +1389,15 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (zone->db != NULL && zone->masterfile == NULL) {
|
||||
|
||||
INSIST(zone->db_argc >= 1);
|
||||
|
||||
rbt = strcmp(zone->db_argv[0], "rbt") == 0 ||
|
||||
strcmp(zone->db_argv[0], "rbt64") == 0;
|
||||
|
||||
if (zone->db != NULL && zone->masterfile == NULL && rbt) {
|
||||
/*
|
||||
* The zone has no master file configured, but it already
|
||||
* has a database. It could be the built-in
|
||||
* version.bind. CH zone, a zone with a persistent
|
||||
* database being reloaded, or maybe a zone that
|
||||
* used to have a master file but whose configuration
|
||||
* was changed so that it no longer has one. Do nothing.
|
||||
* The zone has no master file configured.
|
||||
*/
|
||||
result = ISC_R_SUCCESS;
|
||||
goto cleanup;
|
||||
|
|
@ -1414,7 +1416,6 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Store the current time before the zone is loaded, so that if the
|
||||
* file changes between the time of the load and the time that
|
||||
|
|
@ -1454,21 +1455,20 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
|
|||
}
|
||||
}
|
||||
|
||||
INSIST(zone->db_argc >= 1);
|
||||
|
||||
/*
|
||||
* Built in zones don't need to be reloaded.
|
||||
* Built in zones (with the exception of empty zones) don't need
|
||||
* to be reloaded.
|
||||
*/
|
||||
if (zone->type == dns_zone_master &&
|
||||
strcmp(zone->db_argv[0], "_builtin") == 0 &&
|
||||
(zone->db_argc < 2 || strcmp(zone->db_argv[1], "empty") != 0) &&
|
||||
DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED)) {
|
||||
result = ISC_R_SUCCESS;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((zone->type == dns_zone_slave || zone->type == dns_zone_stub) &&
|
||||
(strcmp(zone->db_argv[0], "rbt") == 0 ||
|
||||
strcmp(zone->db_argv[0], "rbt64") == 0)) {
|
||||
rbt) {
|
||||
if (zone->masterfile == NULL ||
|
||||
!isc_file_exists(zone->masterfile)) {
|
||||
if (zone->masterfile != NULL) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue