]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Dig now reports a missing question section
authorMark Andrews <marka@isc.org>
Mon, 5 Aug 2024 05:09:27 +0000 (15:09 +1000)
committerMichał Kępień <michal@isc.org>
Wed, 7 Aug 2024 11:20:27 +0000 (13:20 +0200)
The question section should be present in the first AXFR/IXFR
response and in other QUERY responses unless no question was sent.
Issue a warning if the question section is not present.

(cherry picked from commit 327e890910b8ff1c0100385e1c17ad0f48c4606a)

bin/dig/dighost.c

index 001e3a46c84a56a8577ceb8f31db801f95fd8096..0419c73ff585bc411811d0952713cd26d5022bc8 100644 (file)
@@ -4237,7 +4237,15 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
                goto keep_query;
        }
 
-       if (msg->counts[DNS_SECTION_QUESTION] != 0) {
+       if (msg->counts[DNS_SECTION_QUESTION] == 0) {
+               if (l->doing_xfr) {
+                       if (query->msg_count == 0) {
+                               dighost_warning("missing question section");
+                       }
+               } else if (!l->header_only && msg->opcode == dns_opcode_query) {
+                       dighost_warning("missing question section");
+               }
+       } else {
                match = true;
                for (result = dns_message_firstname(msg, DNS_SECTION_QUESTION);
                     result == ISC_R_SUCCESS && match;