diff --git a/CHANGES b/CHANGES index d23c220626..83ff593050 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +4014. [bug] When including a master file origin_changed was + not being properly set leading to a potentially + spurious 'inherited owner' warning. [RT #37919] + 4013. [func] Add a new tcp-only option to server (config) / peer (struct) to use TCP transport to send queries (in place of UDP transport with a diff --git a/bin/tests/system/checkzone/tests.sh b/bin/tests/system/checkzone/tests.sh index e8b1bbad7c..9f9b0b5d46 100644 --- a/bin/tests/system/checkzone/tests.sh +++ b/bin/tests/system/checkzone/tests.sh @@ -92,5 +92,29 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` +echo "I:checking for no 'inherited owner' warning on '\$INCLUDE file' with no new \$ORIGIN ($n)" +ret=0 +$CHECKZONE example zones/nowarn.inherited.owner.db > test.out1.$n 2>&1 || ret=1 +grep "inherited.owner" test.out1.$n > /dev/null && ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + +echo "I:checking for 'inherited owner' warning on '\$ORIGIN + \$INCLUDE file' ($n)" +ret=0 +$CHECKZONE example zones/warn.inherit.origin.db > test.out1.$n 2>&1 || ret=1 +grep "inherited.owner" test.out1.$n > /dev/null || ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + +echo "I:checking for 'inherited owner' warning on '\$INCLUDE file origin' ($n)" +ret=0 +$CHECKZONE example zones/warn.inherited.owner.db > test.out1.$n 2>&1 || ret=1 +grep "inherited.owner" test.out1.$n > /dev/null || ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + echo "I:exit status: $status" exit $status diff --git a/bin/tests/system/checkzone/zones/inherit.db b/bin/tests/system/checkzone/zones/inherit.db new file mode 100644 index 0000000000..d91c052886 --- /dev/null +++ b/bin/tests/system/checkzone/zones/inherit.db @@ -0,0 +1 @@ + NS . diff --git a/bin/tests/system/checkzone/zones/nowarn.inherited.owner.db b/bin/tests/system/checkzone/zones/nowarn.inherited.owner.db new file mode 100644 index 0000000000..d91db363b1 --- /dev/null +++ b/bin/tests/system/checkzone/zones/nowarn.inherited.owner.db @@ -0,0 +1,2 @@ +@ 0 IN SOA . . 0 0 0 0 0 +$INCLUDE "zones/inherit.db" diff --git a/bin/tests/system/checkzone/zones/warn.inherit.origin.db b/bin/tests/system/checkzone/zones/warn.inherit.origin.db new file mode 100644 index 0000000000..c125e20997 --- /dev/null +++ b/bin/tests/system/checkzone/zones/warn.inherit.origin.db @@ -0,0 +1,3 @@ +@ 0 IN SOA . . 0 0 0 0 0 +$ORIGIN @ +$INCLUDE "zones/inherit.db" diff --git a/bin/tests/system/checkzone/zones/warn.inherited.owner.db b/bin/tests/system/checkzone/zones/warn.inherited.owner.db new file mode 100644 index 0000000000..6a1e51dfad --- /dev/null +++ b/bin/tests/system/checkzone/zones/warn.inherited.owner.db @@ -0,0 +1,2 @@ +@ 0 IN SOA . . 0 0 0 0 0 +$INCLUDE "zones/inherit.db" @ diff --git a/lib/dns/master.c b/lib/dns/master.c index 3f46c8b35b..da79c90ae4 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -526,6 +526,7 @@ incctx_create(isc_mem_t *mctx, dns_name_t *origin, dns_incctx_t **ictxp) { ictx->drop = ISC_FALSE; ictx->glue_line = 0; ictx->current_line = 0; + ictx->origin_changed = ISC_TRUE; *ictxp = ictx; return (ISC_R_SUCCESS); @@ -1125,7 +1126,6 @@ load_text(dns_loadctx_t *lctx) { line = isc_lex_getsourceline(lctx->lex); source = isc_lex_getsourcename(lctx->lex); ictx = lctx->inc; - EXPECTEOL; continue; } done = ISC_TRUE; @@ -1215,7 +1215,6 @@ load_text(dns_loadctx_t *lctx) { token.type == isc_tokentype_eof) { if (token.type == isc_tokentype_eof) WARNUNEXPECTEDEOF(lctx->lex); - isc_lex_ungettoken(lctx->lex, &token); /* * No origin field. */ @@ -1434,6 +1433,7 @@ load_text(dns_loadctx_t *lctx) { } if (finish_include) { finish_include = ISC_FALSE; + EXPECTEOL; result = pushfile(include_file, new_name, lctx); if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); @@ -1444,6 +1444,7 @@ load_text(dns_loadctx_t *lctx) { goto insist_and_cleanup; } ictx = lctx->inc; + ictx->origin_changed = ISC_TRUE; source = isc_lex_getsourcename(lctx->lex); line = isc_lex_getsourceline(lctx->lex); POST(line); @@ -2075,6 +2076,11 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) { if (result != ISC_R_SUCCESS) return (result); + /* + * Push origin_changed. + */ + new->origin_changed = ictx->origin_changed; + /* Set current domain. */ if (ictx->glue != NULL || ictx->current != NULL) { for (new_in_use = 0; new_in_use < NBUFS; new_in_use++)