Commit db8938c9 authored by Mark Andrews's avatar Mark Andrews
Browse files

3710. [bug] Address double dns_zone_detach when switching to

                        using automatic empty zones from regular zones.
                        [RT #35177]
parent 57600956
3710. [bug] Address double dns_zone_detach when switching to
using automatic empty zones from regular zones.
[RT #35177]
3709. [port] Use built-in versions of strptime() and timegm()
on all platforms to avoid portability issues.
[RT #35183]
......
......@@ -1385,26 +1385,22 @@ on_disable_list(const cfg_obj_t *disablelist, dns_name_t *zonename) {
return (ISC_FALSE);
}
static void
check_dbtype(dns_zone_t **zonep, unsigned int dbtypec, const char **dbargv,
static isc_result_t
check_dbtype(dns_zone_t *zone, unsigned int dbtypec, const char **dbargv,
isc_mem_t *mctx)
{
char **argv = NULL;
unsigned int i;
isc_result_t result;
isc_result_t result = ISC_R_SUCCESS;
result = dns_zone_getdbtype(*zonep, &argv, mctx);
if (result != ISC_R_SUCCESS) {
dns_zone_detach(zonep);
return;
}
CHECK(dns_zone_getdbtype(zone, &argv, mctx));
/*
* Check that all the arguments match.
*/
for (i = 0; i < dbtypec; i++)
if (argv[i] == NULL || strcmp(argv[i], dbargv[i]) != 0) {
dns_zone_detach(zonep);
CHECK(ISC_R_FAILURE);
break;
}
......@@ -1412,8 +1408,11 @@ check_dbtype(dns_zone_t **zonep, unsigned int dbtypec, const char **dbargv,
* Check that there are not extra arguments.
*/
if (i == dbtypec && argv[i] != NULL)
dns_zone_detach(zonep);
result = ISC_R_FAILURE;
cleanup:
isc_mem_free(mctx, argv);
return (result);
}
static isc_result_t
......@@ -2176,12 +2175,21 @@ create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view,
* Is the existing zone the ok to use?
*/
if (zone != NULL) {
if (db != NULL)
check_dbtype(&zone, rbt_dbtypec, rbt_dbtype,
view->mctx);
else
check_dbtype(&zone, empty_dbtypec, empty_dbtype,
view->mctx);
unsigned int typec;
const char **dbargv;
if (db != NULL) {
typec = rbt_dbtypec;
dbargv = rbt_dbtype;
} else {
typec = empty_dbtypec;
dbargv = empty_dbtype;
}
result = check_dbtype(zone, typec, dbargv, view->mctx);
if (result != ISC_R_SUCCESS)
zone = NULL;
if (zone != NULL && dns_zone_gettype(zone) != dns_zone_master)
zone = NULL;
if (zone != NULL && dns_zone_getfile(zone) != NULL)
......
......@@ -63,7 +63,9 @@ RRCHECKER=$TOP/bin/tools/named-rrchecker
SUBDIRS="acl additional allow_query addzone autosign builtin
cacheclean case checkconf @CHECKDS@ checknames checkzone @COVERAGE@
database dlv dlvauto dlz dlzexternal dlzredir dname dns64 dnssec
dsdigest dscp ecdsa formerr forward glue gost ixfr inline limits
dsdigest dscp ecdsa
emptyzones
formerr forward glue gost ixfr inline limits
logfileconfig lwresd masterfile masterformat metadata
notify nsupdate pending @PKCS11_TEST@ redirect resolver rndc rpz
rrl rrchecker rrsetorder rsabigexponent smartsign sortlist spf
......
; Copyright (C) 2014 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.
@ 0 SOA . . 0 0 0 0 0
@ 0 NS .
/*
* Copyright (C) 2004, 2007, 2009, 2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* 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.15 2009/05/29 23:47:49 tbox Exp $ */
key rndc_key {
algorithm hmac-sha256;
secret "1234abcd8765";
};
controls {
inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
};
options {
query-source address 10.53.0.1 dscp 1;
notify-source 10.53.0.1 dscp 2;
transfer-source 10.53.0.1 dscp 3;
port 5300;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
recursion yes;
acache-enable yes;
deny-answer-addresses { 192.0.2.0/24; 2001:db8:beef::/48; }
except-from { "example.org"; };
deny-answer-aliases { "example.org"; }
except-from { "goodcname.example.net";
"gooddname.example.net"; };
allow-query {!10.53.0.8; any; };
};
zone "." {
type hint;
file "root.hint";
};
include "rfc1918.zones";
/*
* Copyright (C) 2004, 2007, 2009, 2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* 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.15 2009/05/29 23:47:49 tbox Exp $ */
key rndc_key {
algorithm hmac-sha256;
secret "1234abcd8765";
};
controls {
inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
};
options {
query-source address 10.53.0.1 dscp 1;
notify-source 10.53.0.1 dscp 2;
transfer-source 10.53.0.1 dscp 3;
port 5300;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
recursion yes;
acache-enable yes;
deny-answer-addresses { 192.0.2.0/24; 2001:db8:beef::/48; }
except-from { "example.org"; };
deny-answer-aliases { "example.org"; }
except-from { "goodcname.example.net";
"gooddname.example.net"; };
allow-query {!10.53.0.8; any; };
};
zone "." {
type hint;
file "root.hint";
};
zone "10.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "16.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "17.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "18.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "19.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "20.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "21.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "22.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "23.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "24.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "25.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "26.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "27.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "28.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "29.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "30.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "31.172.IN-ADDR.ARPA" { type master; file "empty.db"; };
zone "168.192.IN-ADDR.ARPA" { type master; file "empty.db"; };
; Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
; Copyright (C) 2000, 2001 Internet Software Consortium.
;
; 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: root.hint,v 1.7 2007/06/19 23:47:05 tbox Exp $
$TTL 999999
. IN NS a.root-servers.nil.
a.root-servers.nil. IN A 10.53.0.2
cp -f ns1/named1.conf ns1/named.conf
#!/bin/sh
#
# Copyright (C) 2014 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.
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
status=0
n=0
n=`expr $n + 1`
echo "I:check that switching to automatic empty zones works ($n)"
ret=0
$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reload > /dev/null || ret=1
sleep 5
cp ns1/named2.conf ns1/named.conf
$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reload > /dev/null || ret=1
sleep 5
$DIG +vc version.bind txt ch @10.53.0.1 -p 5300 > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
exit $status
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment