From 162e6fb25ab9f61b7c1fe69c54dc5e8b17601bcf Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Date: Wed, 24 Mar 2021 12:49:22 +1300
Subject: [PATCH] librpc/idl: dnsp tombstone timestamp name matches MS-DNSP

MS-DNSP uses the term "EntombedTime" in e.g. "2.2.2.2.4.23 DNS_RPC_RECORD_TS"
which is more descriptive than the generic "timestamp", and less likely to be
confused with dwTimestamp, which has been our curse. Let's make it grep-able,
google-able, and evocative.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
---
 librpc/idl/dnsp.idl                     | 2 +-
 librpc/idl/dnsserver.idl                | 2 +-
 source4/dns_server/dnsserver_common.c   | 6 +++---
 source4/dsdb/kcc/scavenge_dns_records.c | 4 ++--
 source4/rpc_server/dnsserver/dnsdata.c  | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/librpc/idl/dnsp.idl b/librpc/idl/dnsp.idl
index 2fb45a217a4..2270ed5584c 100644
--- a/librpc/idl/dnsp.idl
+++ b/librpc/idl/dnsp.idl
@@ -200,7 +200,7 @@ interface dnsp
 	} dnsp_string_list;
 
 	typedef [nodiscriminant,gensize] union {
-		[case(DNS_TYPE_TOMBSTONE)] 		    NTTIME timestamp;
+		[case(DNS_TYPE_TOMBSTONE)] 		    NTTIME EntombedTime;
 		[case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)]   ipv4address ipv4;
 		[case(DNS_TYPE_NS)]                         dnsp_name ns;
 		[case(DNS_TYPE_CNAME)]                      dnsp_name cname;
diff --git a/librpc/idl/dnsserver.idl b/librpc/idl/dnsserver.idl
index 50cbfbee90f..59d0a7d358a 100644
--- a/librpc/idl/dnsserver.idl
+++ b/librpc/idl/dnsserver.idl
@@ -118,7 +118,7 @@ import "misc.idl", "dnsp.idl";
 	DNS_RPC_RECORD_SRV;
 
 	typedef [nodiscriminant,gensize,flag(NDR_NOALIGN)] union {
-		[case(DNS_TYPE_TOMBSTONE)] 		    NTTIME timestamp;
+		[case(DNS_TYPE_TOMBSTONE)] 		    NTTIME EntombedTime;
 		[case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)]   ipv4address ipv4;
 		[case(DNS_TYPE_NS)]    				DNS_RPC_NAME name;
 		[case(DNS_TYPE_MD)]    				DNS_RPC_NAME name;
diff --git a/source4/dns_server/dnsserver_common.c b/source4/dns_server/dnsserver_common.c
index bc0f8ad6c23..7bd6e4f64bd 100644
--- a/source4/dns_server/dnsserver_common.c
+++ b/source4/dns_server/dnsserver_common.c
@@ -214,7 +214,7 @@ WERROR dns_common_lookup(struct ldb_context *samdb,
 				 * a tombstone, this will be used
 				 * in dns_common_replace()
 				 */
-				.data.timestamp = 1,
+				.data.EntombedTime = 1,
 			};
 
 			*tombstoned = true;
@@ -1008,7 +1008,7 @@ WERROR dns_common_replace(struct ldb_context *samdb,
 		enum ndr_err_code ndr_err;
 
 		if (records[i].wType == DNS_TYPE_TOMBSTONE) {
-			if (records[i].data.timestamp != 0) {
+			if (records[i].data.EntombedTime != 0) {
 				was_tombstoned = true;
 			}
 			continue;
@@ -1074,7 +1074,7 @@ WERROR dns_common_replace(struct ldb_context *samdb,
 		tbs = (struct dnsp_DnssrvRpcRecord) {
 			.wType = DNS_TYPE_TOMBSTONE,
 			.dwSerial = serial,
-			.data.timestamp = timeval_to_nttime(&tv),
+			.data.EntombedTime = timeval_to_nttime(&tv),
 		};
 
 		ndr_err = ndr_push_struct_blob(v, el->values, &tbs,
diff --git a/source4/dsdb/kcc/scavenge_dns_records.c b/source4/dsdb/kcc/scavenge_dns_records.c
index 8bcb35f079a..be4bfaa213f 100644
--- a/source4/dsdb/kcc/scavenge_dns_records.c
+++ b/source4/dsdb/kcc/scavenge_dns_records.c
@@ -334,7 +334,7 @@ NTSTATUS dns_tombstone_records(TALLOC_CTX *mem_ctx,
 	t /= 3600;
 
 	tombstone_struct = (struct dnsp_DnssrvRpcRecord){
-	    .wType = DNS_TYPE_TOMBSTONE, .data = {.timestamp = t}};
+	    .wType = DNS_TYPE_TOMBSTONE, .data = {.EntombedTime = t}};
 
 	true_struct = (struct ldb_val){.data = true_str, .length = 4};
 
@@ -453,7 +453,7 @@ NTSTATUS dns_delete_tombstones(TALLOC_CTX *mem_ctx,
 				continue;
 			}
 
-			if (rec->data.timestamp > tombstone_time) {
+			if (rec->data.EntombedTime > tombstone_time) {
 				continue;
 			}
 
diff --git a/source4/rpc_server/dnsserver/dnsdata.c b/source4/rpc_server/dnsserver/dnsdata.c
index 31d0233cf52..ae64b9b643c 100644
--- a/source4/rpc_server/dnsserver/dnsdata.c
+++ b/source4/rpc_server/dnsserver/dnsdata.c
@@ -306,7 +306,7 @@ void dnsp_to_dns_copy(TALLOC_CTX *mem_ctx, struct dnsp_DnssrvRpcRecord *dnsp,
 	switch (dnsp->wType) {
 
 	case DNS_TYPE_TOMBSTONE:
-		dns->data.timestamp = dnsp->data.timestamp;
+		dns->data.EntombedTime = dnsp->data.EntombedTime;
 		break;
 
 	case DNS_TYPE_A:
@@ -437,7 +437,7 @@ WERROR dns_to_dnsp_convert(TALLOC_CTX *mem_ctx, struct DNS_RPC_RECORD *dns,
 	switch (dns->wType) {
 
 	case DNS_TYPE_TOMBSTONE:
-		dnsp->data.timestamp = dns->data.timestamp;
+		dnsp->data.EntombedTime = dns->data.EntombedTime;
 		break;
 
 	case DNS_TYPE_A: