]> 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 02:44:47 +0000 (13:44 +1100)
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.

(cherry picked from commit 5e49a9e4ae8d0a78fb5ac0c7b683de9a29b6b848)

lib/dns/rbtdb.c

index 8a63d5312a863b25d0ac504b58bc577c8908585d..6b35b25715289367c1fb1a29e9de5ba8b4e1c037 100644 (file)
@@ -6145,14 +6145,6 @@ cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_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 the priority list, we know there will not be
-                        * CNAME, so we are safe to skip the rest of the types.
-                        */
-                       return false;
-               }
                if (header->type == dns_rdatatype_cname) {
                        /*
                         * Look for an active extant CNAME.
@@ -6208,6 +6200,16 @@ cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_t serial) {
                                        }
                                } 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_data = true;
                                }
                        }