diff --git a/CHANGES b/CHANGES index 49e562b561..02e289ae2b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3803. [bug] "named-checkconf -z" incorrectly rejected zones + using alternate data sources for not having a "file" + option. [RT #35685] + 3802. [bug] Various header files were not being installed. --- 9.10.0rc1 released --- diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 7b7f4ea509..e79cbc1823 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -178,10 +178,12 @@ configure_zone(const char *vclass, const char *view, const char *zname; const char *zfile = NULL; const cfg_obj_t *maps[4]; + const cfg_obj_t *mastersobj = NULL; const cfg_obj_t *zoptions = NULL; const cfg_obj_t *classobj = NULL; const cfg_obj_t *typeobj = NULL; const cfg_obj_t *fileobj = NULL; + const cfg_obj_t *dlzobj = NULL; const cfg_obj_t *dbobj = NULL; const cfg_obj_t *obj = NULL; const cfg_obj_t *fmtobj = NULL; @@ -212,6 +214,19 @@ configure_zone(const char *vclass, const char *view, if (typeobj == NULL) return (ISC_R_FAILURE); + /* + * Skip checks when using an alternate data source. + */ + cfg_map_get(zoptions, "database", &dbobj); + if (dbobj != NULL && + strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 && + strcmp("rbt64", cfg_obj_asstring(dbobj)) != 0) + return (ISC_R_SUCCESS); + + cfg_map_get(zoptions, "dlz", &dlzobj); + if (dlzobj != NULL) + return (ISC_R_SUCCESS); + cfg_map_get(zoptions, "file", &fileobj); if (fileobj != NULL) zfile = cfg_obj_asstring(fileobj); @@ -227,13 +242,18 @@ configure_zone(const char *vclass, const char *view, (strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0)) return (ISC_R_SUCCESS); + /* + * Is the redirect zone configured as a slave? + */ + if (strcasecmp(cfg_obj_asstring(typeobj), "redirect") == 0) { + cfg_map_get(zoptions, "masters", &mastersobj); + if (mastersobj != NULL) + return (ISC_R_SUCCESS); + } + if (zfile == NULL) return (ISC_R_FAILURE); - cfg_map_get(zoptions, "database", &dbobj); - if (dbobj != NULL) - return (ISC_R_SUCCESS); - obj = NULL; if (get_maps(maps, "check-dup-records", &obj)) { if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { diff --git a/bin/tests/system/checkconf/altdb.conf b/bin/tests/system/checkconf/altdb.conf new file mode 100644 index 0000000000..5c3a8060cb --- /dev/null +++ b/bin/tests/system/checkconf/altdb.conf @@ -0,0 +1,22 @@ +/* + * 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. + */ + +view override_bind chaos { + zone "version.bind" chaos { + type master; + database "_builtin version"; + }; +}; diff --git a/bin/tests/system/checkconf/altdlz.conf b/bin/tests/system/checkconf/altdlz.conf new file mode 100644 index 0000000000..2f663da0f2 --- /dev/null +++ b/bin/tests/system/checkconf/altdlz.conf @@ -0,0 +1,25 @@ +/* + * 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. + */ + +dlz external { + database "dlopen driver.so"; + search no; +}; + +zone "example.com" { + type master; + dlz external; +}; diff --git a/bin/tests/system/checkconf/good.conf b/bin/tests/system/checkconf/good.conf index 71911ca1e7..be652696b0 100644 --- a/bin/tests/system/checkconf/good.conf +++ b/bin/tests/system/checkconf/good.conf @@ -108,6 +108,12 @@ view "second" { zone "clone" { in-view "first"; }; + zone "." { + type redirect; + masters { + 1.2.3.4 ; + }; + }; dnssec-lookaside "." trust-anchor "dlv.isc.org."; dnssec-validation auto; zone-statistics full; @@ -132,6 +138,12 @@ view "third" { "any"; }; }; +view "chaos" chaos { + zone "hostname.bind" chaos { + type master; + database "_builtin hostname"; + }; +}; key "mykey" { algorithm "hmac-md5"; secret "qwertyuiopasdfgh"; diff --git a/bin/tests/system/checkconf/tests.sh b/bin/tests/system/checkconf/tests.sh index 634c28cc0b..f3d87f0981 100644 --- a/bin/tests/system/checkconf/tests.sh +++ b/bin/tests/system/checkconf/tests.sh @@ -179,5 +179,17 @@ $CHECKCONF -z max-ttl-bad.conf > /dev/null 2>&1 && ret=1 if [ $ret != 0 ]; then echo "I:failed"; ret=1; fi status=`expr $status + $ret` +echo "I: checking that named-checkconf -z skips zone check with alternate databases" +ret=0 +$CHECKCONF -z altdb.conf > /dev/null 2>&1 || ret=1 +if [ $ret != 0 ]; then echo "I:failed"; ret=1; fi +status=`expr $status + $ret` + +echo "I: checking that named-checkconf -z skips zone check with DLZ" +ret=0 +$CHECKCONF -z altdlz.conf > /dev/null 2>&1 || ret=1 +if [ $ret != 0 ]; then echo "I:failed"; ret=1; fi +status=`expr $status + $ret` + echo "I:exit status: $status" exit $status