From 22f467116c907184eccf5a64bfdf8ea4b13efbdb Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Tue, 23 Jun 2015 14:54:34 +0530 Subject: [PATCH] Fix parsing of NZFs saved by rndc addzone with view specified (#39845) (cherry picked from commit 0439bfedd97fa2e004cbf572773d703b33fda10f) Conflicts: bin/named/server.c bin/tests/system/addzone/tests.sh (cherry picked from commit 8134e7662e8da5d3f894bd33342dfd997de21c7c) Conflicts: CHANGES --- CHANGES | 4 ++++ bin/tests/system/addzone/tests.sh | 11 ++++++++++ lib/isccfg/namedconf.c | 35 +++++++++++++++---------------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index 689ddafbc7..fca59ecbba 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +4142. [bug] rndc addzone with view specified saved NZF config + that could not be read back by named. This has now + been fixed. [RT #39845] + 4138. [bug] An uninitialized value in validator.c could result in an assertion failure. (CVE-2015-4620) [RT #39795] diff --git a/bin/tests/system/addzone/tests.sh b/bin/tests/system/addzone/tests.sh index 9d19589ecb..a7fce0441f 100755 --- a/bin/tests/system/addzone/tests.sh +++ b/bin/tests/system/addzone/tests.sh @@ -215,6 +215,17 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` +echo "I:checking rndc reload causes named to reload the external view's NZF file ($n)" +ret=0 +$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /' +$DIG +norec $DIGOPTS @10.53.0.2 -b 10.53.0.2 a.added.example a > dig.out.ns2.int.$n || ret=1 +grep 'status: NOERROR' dig.out.ns2.int.$n > /dev/null || ret=1 +$DIG +norec $DIGOPTS @10.53.0.4 -b 10.53.0.4 a.added.example a > dig.out.ns2.ext.$n || ret=1 +grep 'status: NOERROR' dig.out.ns2.ext.$n > /dev/null || ret=1 +grep '^a.added.example' dig.out.ns2.ext.$n > /dev/null || ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` echo "I:deleting newly added zone ($n)" ret=0 diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 1e1182ea52..500e4c6619 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -1613,24 +1613,6 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_bindkeys = { &cfg_rep_map, bindkeys_clausesets }; -/*% The new-zone-file syntax (for zones added by 'rndc addzone') */ -static cfg_clausedef_t -newzones_clauses[] = { - { "zone", &cfg_type_zone, CFG_CLAUSEFLAG_MULTI }, - { NULL, NULL, 0 } -}; - -static cfg_clausedef_t * -newzones_clausesets[] = { - newzones_clauses, - NULL -}; - -LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_newzones = { - "newzones", cfg_parse_mapbody, cfg_print_mapbody, cfg_doc_mapbody, - &cfg_rep_map, newzones_clausesets -}; - /*% The "options" statement syntax. */ static cfg_clausedef_t * @@ -1827,6 +1809,23 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_addzoneconf = { &cfg_rep_map, addzoneconf_clausesets }; +/*% The new-zone-file syntax (for zones added by 'rndc addzone') */ +static cfg_clausedef_t +newzones_clauses[] = { + { "zone", &cfg_type_addzone, CFG_CLAUSEFLAG_MULTI }, + { NULL, NULL, 0 } +}; + +static cfg_clausedef_t * +newzones_clausesets[] = { + newzones_clauses, + NULL +}; + +LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_newzones = { + "newzones", cfg_parse_mapbody, cfg_print_mapbody, cfg_doc_mapbody, + &cfg_rep_map, newzones_clausesets +}; static isc_result_t parse_unitstring(char *str, isc_resourcevalue_t *valuep) {