From: Douglas Bagnall Date: Fri, 18 Jun 2021 03:31:42 +0000 (+1200) Subject: s4/dns_common_replace: add comments about tombstones X-Git-Tag: tevent-0.11.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54b9271eb5e90c214c7009778ab22d60f9ee88eb;p=thirdparty%2Fsamba.git s4/dns_common_replace: add comments about tombstones Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/dns_server/dnsserver_common.c b/source4/dns_server/dnsserver_common.c index ef582a471c8..5c5ec1f9ebd 100644 --- a/source4/dns_server/dnsserver_common.c +++ b/source4/dns_server/dnsserver_common.c @@ -1012,6 +1012,25 @@ WERROR dns_common_replace(struct ldb_context *samdb, enum ndr_err_code ndr_err; if (records[i].wType == DNS_TYPE_TOMBSTONE) { + /* + * There are two things that could be going on here. + * + * 1. We use a tombstone with EntombedTime == 0 for + * passing deletion messages through the stack, and + * this is the place we filter them out to perform + * that deletion. + * + * 2. This node is tombstoned, with no records except + * for a single tombstone, and it is just waiting to + * disappear. In this case, unless the caller has + * added a record, rec_count should be 1, and + * el->num_values will end up at 0, and we will make + * no changes. But if the caller has added a record, + * we need to un-tombstone the node. + * + * It is not possible to add an explicit tombstone + * record. + */ if (records[i].data.EntombedTime != 0) { was_tombstoned = true; } @@ -1065,6 +1084,10 @@ WERROR dns_common_replace(struct ldb_context *samdb, } if (el->num_values == 0) { + /* + * We get here if there are no records or all the records were + * tombstones. + */ struct dnsp_DnssrvRpcRecord tbs; struct ldb_val *v = &el->values[el->num_values]; enum ndr_err_code ndr_err;