From: Douglas Bagnall Date: Wed, 31 Mar 2021 01:23:36 +0000 (+1300) Subject: dns update: emit warnings upon unexpected occurrances X-Git-Tag: tevent-0.11.0~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f9564425f4b6796034c8db7974e70e33df054dc;p=thirdparty%2Fsamba.git dns update: emit warnings upon unexpected occurrances Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/dns_server/dns_update.c b/source4/dns_server/dns_update.c index 10dfb1160d6..4ec55d471de 100644 --- a/source4/dns_server/dns_update.c +++ b/source4/dns_server/dns_update.c @@ -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, };