diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2021-03-28 11:20:48 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2021-03-29 23:20:37 +0000 |
commit | f1b59e8cb1a0d6e255d2dc90791afa1c96a4ce6c (patch) | |
tree | a6e4ceef799d0c22ecd6618f106957eb68e7eb9b /source4 | |
parent | a32c229b0956f6ed1cf1ad20599539141bbff15d (diff) | |
download | samba-f1b59e8cb1a0d6e255d2dc90791afa1c96a4ce6c.tar.gz |
dsdb/scavange dns: reserve NTTIME type for NTTIME values
We know it "really" just means uint64_t, but we also know it means
100-nanosecond intervals since 1601, and that makes any other use very
confusing (and not just to me, or there wouldn't be these bugs we're
chasing).
In these cases we are talking about 32 bit hours-since-1601 timestamps.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/kcc/scavenge_dns_records.c | 14 | ||||
-rw-r--r-- | source4/dsdb/kcc/scavenge_dns_records.h | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/source4/dsdb/kcc/scavenge_dns_records.c b/source4/dsdb/kcc/scavenge_dns_records.c index 7504d3ac536..1a79795db37 100644 --- a/source4/dsdb/kcc/scavenge_dns_records.c +++ b/source4/dsdb/kcc/scavenge_dns_records.c @@ -46,7 +46,7 @@ NTSTATUS copy_current_records(TALLOC_CTX *mem_ctx, struct ldb_message_element *old_el, struct ldb_message_element *el, - NTTIME t) + uint32_t dns_timestamp) { unsigned int i, num_kept = 0; struct dnsp_DnssrvRpcRecord *recs = NULL; @@ -75,7 +75,7 @@ NTSTATUS copy_current_records(TALLOC_CTX *mem_ctx, DBG_ERR("Failed to pull dns rec blob.\n"); return NT_STATUS_INTERNAL_ERROR; } - if (recs[num_kept].dwTimeStamp > t || + if (recs[num_kept].dwTimeStamp > dns_timestamp || recs[num_kept].dwTimeStamp == 0) { num_kept++; } @@ -117,7 +117,7 @@ NTSTATUS dns_tombstone_records_zone(TALLOC_CTX *mem_ctx, struct dns_server_zone *zone, struct ldb_val *true_struct, struct ldb_val *tombstone_blob, - NTTIME t, + uint32_t dns_timestamp, char **error_string) { WERROR werr; @@ -154,7 +154,7 @@ NTSTATUS dns_tombstone_records_zone(TALLOC_CTX *mem_ctx, /* Subtract them from current time to get the earliest possible. * timestamp allowed for a non-expired DNS record. */ - t -= zi->dwNoRefreshInterval + zi->dwRefreshInterval; + dns_timestamp -= zi->dwNoRefreshInterval + zi->dwRefreshInterval; /* Custom match gets dns records in the zone with dwTimeStamp < t. */ ret = ldb_search(samdb, @@ -166,8 +166,8 @@ NTSTATUS dns_tombstone_records_zone(TALLOC_CTX *mem_ctx, "(&(objectClass=dnsNode)" "(&(!(dnsTombstoned=TRUE))" "(dnsRecord:" DSDB_MATCH_FOR_DNS_TO_TOMBSTONE_TIME - ":=%"PRIu64")))", - t); + ":=%"PRIu32")))", + dns_timestamp); if (ret != LDB_SUCCESS) { *error_string = talloc_asprintf(mem_ctx, "Failed to search for dns " @@ -213,7 +213,7 @@ NTSTATUS dns_tombstone_records_zone(TALLOC_CTX *mem_ctx, } el->num_values = old_el->num_values; - status = copy_current_records(mem_ctx, old_el, el, t); + status = copy_current_records(mem_ctx, old_el, el, dns_timestamp); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(old_msg); diff --git a/source4/dsdb/kcc/scavenge_dns_records.h b/source4/dsdb/kcc/scavenge_dns_records.h index 799fedba258..d97586c97bb 100644 --- a/source4/dsdb/kcc/scavenge_dns_records.h +++ b/source4/dsdb/kcc/scavenge_dns_records.h @@ -39,10 +39,10 @@ NTSTATUS dns_tombstone_records_zone(TALLOC_CTX *mem_ctx, struct dns_server_zone *zone, struct ldb_val *true_struct, struct ldb_val *tombstone_blob, - NTTIME t, + uint32_t dns_timestamp, char **error_string); NTSTATUS copy_current_records(TALLOC_CTX *mem_ctx, struct ldb_message_element *old_el, struct ldb_message_element *el, - NTTIME t); + uint32_t dns_timestamp); |