]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Address inconsistencies in checking added RRsets
authorMark Andrews <marka@isc.org>
Fri, 12 Feb 2021 03:51:28 +0000 (14:51 +1100)
committerMichał Kępień <michal@isc.org>
Thu, 29 Apr 2021 08:30:00 +0000 (10:30 +0200)
loading_addrdataset() rejects SOA RRsets which are not at top of zone.
addrdataset() should similarly reject such RRsets.

lib/dns/rbtdb.c

index f9c93416edabd9499425ca16e8495e1e2597691f..0e4872d1bcef7e117c5c9007edd39eb8804cae7d 100644 (file)
@@ -6798,6 +6798,13 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
        INSIST(rbtversion == NULL || rbtversion->rbtdb == rbtdb);
 
        if (rbtdb->common.methods == &zone_methods) {
+               /*
+                * SOA records are only allowed at top of zone.
+                */
+               if (rdataset->type == dns_rdatatype_soa &&
+                   node != rbtdb->origin_node) {
+                       return (DNS_R_NOTZONETOP);
+               }
                RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
                REQUIRE(((rbtnode->nsec == DNS_RBT_NSEC_NSEC3 &&
                          (rdataset->type == dns_rdatatype_nsec3 ||