diff --git a/CHANGES b/CHANGES index 84fb4c95f3..607aa198c1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +1080. [bug] BIND 8 compatibility: accept bare IP prefixes + as the second element of a two-element top level + sort list statement. [RT #1964] + 1079. [bug] BIND 8 compatibility: accept bare elements at top level of sort list treating them as if they were a single element list. [RT #1963] diff --git a/bin/named/sortlist.c b/bin/named/sortlist.c index 1edc86ec92..47e4f039cc 100644 --- a/bin/named/sortlist.c +++ b/bin/named/sortlist.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sortlist.c,v 1.7 2001/10/30 19:45:33 gson Exp $ */ +/* $Id: sortlist.c,v 1.8 2001/10/30 20:19:32 gson Exp $ */ #include @@ -69,19 +69,28 @@ ns_sortlist_setup(dns_acl_t *acl, isc_netaddr_t *clientaddr, void **argp) { &matched_elt)) { if (order_elt != NULL) { if (order_elt->type == - dns_aclelementtype_nestedacl) + dns_aclelementtype_nestedacl) { *argp = order_elt->u.nestedacl; - else if (order_elt->type == - dns_aclelementtype_localhost && - ns_g_server->aclenv.localhost != NULL) + return (NS_SORTLISTTYPE_2ELEMENT); + } else if (order_elt->type == + dns_aclelementtype_localhost && + ns_g_server->aclenv.localhost != NULL) { *argp = ns_g_server->aclenv.localhost; - else if (order_elt->type == - dns_aclelementtype_localnets && - ns_g_server->aclenv.localnets != NULL) + return (NS_SORTLISTTYPE_2ELEMENT); + } else if (order_elt->type == + dns_aclelementtype_localnets && + ns_g_server->aclenv.localnets != NULL) { *argp = ns_g_server->aclenv.localnets; - else - goto dont_sort; - return (NS_SORTLISTTYPE_2ELEMENT); + return (NS_SORTLISTTYPE_2ELEMENT); + } else { + /* + * BIND 8 allows a bare IP prefix as + * the 2nd element of a 2-element + * sortlist statement. + */ + *argp = order_elt; + return (NS_SORTLISTTYPE_1ELEMENT); + } } else { INSIST(matched_elt != NULL); *argp = matched_elt; diff --git a/bin/tests/system/sortlist/ns1/named.conf b/bin/tests/system/sortlist/ns1/named.conf index 1b19258c9e..de872b2ee2 100644 --- a/bin/tests/system/sortlist/ns1/named.conf +++ b/bin/tests/system/sortlist/ns1/named.conf @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named.conf,v 1.5 2001/01/09 21:44:40 bwelling Exp $ */ +/* $Id: named.conf,v 1.6 2001/10/30 20:19:34 gson Exp $ */ options { query-source address 10.53.0.1; @@ -34,7 +34,9 @@ options { !1.1.1.4; !1.1.1.2; !1.1.1.3; !1.1.1.1; // sort these last, 192.168.3/24; // this first { 192.168.2/24; 192.168.1/24; }; }; }; // and these next - { { 10.53.0.2; 10.53.0.3; }; }; // Prefer self + { { 10.53.0.2; 10.53.0.3; }; }; // Prefer self + 10.53.0.4; // BIND 8 compat + { 10.53.0.5; 10.53.0.5; }; // BIND 8 compat }; }; diff --git a/bin/tests/system/sortlist/tests.sh b/bin/tests/system/sortlist/tests.sh index 5b4dc6a94c..68053d8648 100644 --- a/bin/tests/system/sortlist/tests.sh +++ b/bin/tests/system/sortlist/tests.sh @@ -15,7 +15,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: tests.sh,v 1.4 2001/01/13 00:02:55 gson Exp $ +# $Id: tests.sh,v 1.5 2001/10/30 20:19:33 gson Exp $ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh @@ -38,8 +38,8 @@ $DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd a.example. \ # result RRs is significant. diff test1.dig test1.good || status=1 -echo "I:test 1-element sortlist statement" -for n in 2 3 +echo "I:test 1-element sortlist statement and undocumented BIND 8 features" +for n in 2 3 4 5 do cat <test2.good b.example. 300 IN A 10.53.0.$n