]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4014. [bug] When including a master file origin_changed was
authorMark Andrews <marka@isc.org>
Tue, 2 Dec 2014 22:42:30 +0000 (09:42 +1100)
committerMark Andrews <marka@isc.org>
Tue, 2 Dec 2014 22:42:30 +0000 (09:42 +1100)
                        not being properly set leading to a potentially
                        spurious 'inherited owner' warning. [RT #37919]

CHANGES
bin/tests/system/checkzone/tests.sh
bin/tests/system/checkzone/zones/inherit.db [new file with mode: 0644]
bin/tests/system/checkzone/zones/nowarn.inherited.owner.db [new file with mode: 0644]
bin/tests/system/checkzone/zones/warn.inherit.origin.db [new file with mode: 0644]
bin/tests/system/checkzone/zones/warn.inherited.owner.db [new file with mode: 0644]
lib/dns/master.c

diff --git a/CHANGES b/CHANGES
index d23c220626b4c788fdb9021b43c707fed841b6ca..83ff593050dcde0e5bd3cfe93926813226ab3d21 100644 (file)
--- 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
index e8b1bbad7c3b08b1e9c7c4abd288f7d70a2eb9a9..9f9b0b5d46137125c9fb1d6b1c77212bd2fd6017 100644 (file)
@@ -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 (file)
index 0000000..d91c052
--- /dev/null
@@ -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 (file)
index 0000000..d91db36
--- /dev/null
@@ -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 (file)
index 0000000..c125e20
--- /dev/null
@@ -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 (file)
index 0000000..6a1e51d
--- /dev/null
@@ -0,0 +1,2 @@
+@ 0 IN SOA . . 0 0 0 0 0
+$INCLUDE "zones/inherit.db" @
index 3f46c8b35b466635d2a4fbc2868272377834678d..da79c90ae4db8615f4b64699b9ea2f52a51a4046 100644 (file)
@@ -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++)