]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix "CNAME and other data" detection
authorMark Andrews <marka@isc.org>
Thu, 30 Jan 2025 22:09:33 +0000 (09:09 +1100)
committerMark Andrews <marka@isc.org>
Fri, 14 Feb 2025 01:51:38 +0000 (01:51 +0000)
prio_type was being used in the wrong place to optimize cname_and_other.
We have to first exclude and accepted types and we also have to
determine that the record exists before we can check if we are at
a point where a later CNAME cannot appear.

lib/dns/qpzone.c

index e0ddab3bfbfc35bf19cfe6e51e0f928473256d34..14ede511ab50d78bf760613f109b57611eba45c6 100644 (file)
@@ -1727,15 +1727,6 @@ cname_and_other(qpznode_t *node, uint32_t serial) {
        for (header = node->data; header != NULL; header = header_next) {
                header_next = header->next;
 
-               if (!prio_type(header->type)) {
-                       /*
-                        * CNAME is in the priority list, so if we are done
-                        * with priority types, we know there will not be a
-                        * CNAME, and are safe to skip the rest.
-                        */
-                       return false;
-               }
-
                rdtype = DNS_TYPEPAIR_TYPE(header->type);
                if (rdtype == dns_rdatatype_cname) {
                        do {
@@ -1767,6 +1758,15 @@ cname_and_other(qpznode_t *node, uint32_t serial) {
                                header = header->down;
                        } while (header != NULL);
                        if (header != NULL) {
+                               if (!prio_type(header->type)) {
+                                       /*
+                                        * CNAME is in the priority list, so if
+                                        * we are done with priority types, we
+                                        * know there will not be a CNAME, and
+                                        * are safe to skip the rest.
+                                        */
+                                       return cname;
+                               }
                                other = true;
                        }
                }