From 8f25faf9720a0c2730c4ac80ea4c12ca1f25599f Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Tue, 5 May 2015 13:09:07 +0530 Subject: [PATCH] Fix a regression in radix tree implementation introduced by ECS code (#38983) --- CHANGES | 5 +++++ bin/tests/system/checkconf/good-nested.conf | 7 +++++++ bin/tests/system/checkconf/tests.sh | 11 ++++++++++- lib/isc/radix.c | 4 +++- 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 bin/tests/system/checkconf/good-nested.conf diff --git a/CHANGES b/CHANGES index 7ca6e7c1b2..790fe67962 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +4114. [bug] Fix a regression in radix tree implementation + introduced by ECS code. This bug was never + released, but it was reported by a user testing + master. [RT #38983] + 4113. [test] Check for Net::DNS is some system test prerequisites. [RT #39369] diff --git a/bin/tests/system/checkconf/good-nested.conf b/bin/tests/system/checkconf/good-nested.conf new file mode 100644 index 0000000000..03bc22b2d5 --- /dev/null +++ b/bin/tests/system/checkconf/good-nested.conf @@ -0,0 +1,7 @@ +acl a { 127.0.0.1; ::1; }; +acl b { a; }; +acl c { !b; }; + +options { + allow-query { c; }; +}; diff --git a/bin/tests/system/checkconf/tests.sh b/bin/tests/system/checkconf/tests.sh index d492298531..6a77f7738b 100644 --- a/bin/tests/system/checkconf/tests.sh +++ b/bin/tests/system/checkconf/tests.sh @@ -42,7 +42,7 @@ grep 'secret "????????????????"' good.conf.out > /dev/null 2>&1 || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -for bad in bad*.conf +for bad in bad-*.conf do ret=0 echo "I: checking that named-checkconf detects error in $bad" @@ -51,6 +51,15 @@ do status=`expr $status + $ret` done +for good in good-*.conf +do + ret=0 + echo "I: checking that named-checkconf detects no error in $good" + $CHECKCONF $good > /dev/null 2>&1 + if [ $? != 0 ]; then echo "I:failed"; ret=1; fi + status=`expr $status + $ret` +done + echo "I: checking that named-checkconf -z catches missing hint file" ret=0 $CHECKCONF -z hint-nofile.conf > hint-nofile.out 2>&1 && ret=1 diff --git a/lib/isc/radix.c b/lib/isc/radix.c index a1d8235d94..b302f8c920 100644 --- a/lib/isc/radix.c +++ b/lib/isc/radix.c @@ -520,8 +520,10 @@ isc_radix_insert(isc_radix_tree_t *radix, isc_radix_node_t **target, } new_node->parent = NULL; new_node->l = new_node->r = NULL; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { new_node->node_num[i] = -1; + new_node->data[i] = NULL; + } radix->num_active_node++; if (source != NULL) {