]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dns update: emit warnings upon unexpected occurrances
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 31 Mar 2021 01:23:36 +0000 (14:23 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 5 Jul 2021 04:16:34 +0000 (04:16 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dns_server/dns_update.c

index 10dfb1160d6f24a6acfe3d6cc760e9f0779bc358..4ec55d471de971f724254ebcb7eafce14d62833e 100644 (file)
@@ -431,8 +431,18 @@ static WERROR handle_one_update(struct dns_server *dns,
        if (tombstoned) {
                /*
                 * we need to keep the existing tombstone record
-                * and ignore it
+                * and ignore it.
+                *
+                * There *should* only be a single record of type TOMBSTONE,
+                * but we don't insist.
                 */
+               if (rcount != 1) {
+                       DBG_WARNING("Tombstoned dnsNode has %u records, "
+                                   "expected 1\n", rcount);
+                       if (DEBUGLVL(1)) {
+                               NDR_PRINT_DEBUG(dns_res_rec, discard_const(update));
+                       }
+               }
                first = rcount;
        }
 
@@ -519,11 +529,20 @@ static WERROR handle_one_update(struct dns_server *dns,
                            mem_ctx, update, &recs[i], name_is_static);
                        W_ERROR_NOT_OK_RETURN(werror);
 
+                       /*
+                        * There should only be one SOA, which we have already
+                        * found and replaced. We now check for and tombstone
+                        * any others.
+                        */
                        for (i++; i < rcount; i++) {
                                if (recs[i].wType != DNS_TYPE_SOA) {
                                        continue;
                                }
-
+                               DBG_ERR("Duplicate SOA records found.\n");
+                               if (DEBUGLVL(0)) {
+                                       NDR_PRINT_DEBUG(dns_res_rec,
+                                                       discard_const(update));
+                               }
                                recs[i] = (struct dnsp_DnssrvRpcRecord) {
                                        .wType = DNS_TYPE_TOMBSTONE,
                                };