From 883e29ab4fe555a74f8eff46574a6f79b36896bb Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 11 Oct 2016 15:03:24 +1100 Subject: [PATCH] 4483. [func] Check prefixes in acls to make sure the address and prefix lengths are consistent. Warn only in BIND 9.11 and earlier. [RT #43367] --- CHANGES | 4 ++++ bin/tests/system/checkconf/good-acl.conf | 2 +- bin/tests/system/pending/ns2/named.conf | 2 +- lib/isccfg/aclconf.c | 10 ++++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 9834804f59..e34ee5c494 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +4483. [func] Check prefixes in acls to make sure the address and + prefix lengths are consistent. Warn only in + BIND 9.11 and earlier. [RT #43367] + 4482. [bug] Address use before require check and remove extraneous dns_message_gettsigkey call in dns_tsig_sign. [RT #43374] diff --git a/bin/tests/system/checkconf/good-acl.conf b/bin/tests/system/checkconf/good-acl.conf index 043375e8ec..2045c96978 100644 --- a/bin/tests/system/checkconf/good-acl.conf +++ b/bin/tests/system/checkconf/good-acl.conf @@ -16,7 +16,7 @@ acl a { { "none"; }; - { !19.0.0.0/0; }; + { !19.0.0.0/8; }; }; options { diff --git a/bin/tests/system/pending/ns2/named.conf b/bin/tests/system/pending/ns2/named.conf index 562c7c65a5..aa64eac4f3 100644 --- a/bin/tests/system/pending/ns2/named.conf +++ b/bin/tests/system/pending/ns2/named.conf @@ -49,7 +49,7 @@ zone "example" { zone "example.com" { type master; file "example.com.db.signed"; - allow-update { 10.53.0.0/8; }; + allow-update { 10.53.0.0/16; }; }; zone "good" { diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c index 38fef0f577..4a4b957542 100644 --- a/lib/isccfg/aclconf.c +++ b/lib/isccfg/aclconf.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - #include #include @@ -391,6 +389,14 @@ cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, dns_acl_detach(&de->nestedacl); continue; } + result = isc_netaddr_prefixok(&addr, bitlen); + if (result != ISC_R_SUCCESS) { + char buf[ISC_NETADDR_FORMATSIZE + 1]; + isc_netaddr_format(&addr, buf, sizeof(buf)); + cfg_obj_log(ce, lctx, ISC_LOG_WARNING, + "'%s/%u': address/prefix length " + "mismatch", buf, bitlen); + } /* * If nesting ACLs (nest_level != 0), we negate