summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2021-03-11 15:58:37 +1300
committerJeremy Allison <jra@samba.org>2021-03-29 23:20:37 +0000
commita32c229b0956f6ed1cf1ad20599539141bbff15d (patch)
tree04a69eed3bd06c12c204d43acb5586a8a1073da6 /source4
parent146c23fb7d98515c4dd0349d0406b7f459d3b696 (diff)
downloadsamba-a32c229b0956f6ed1cf1ad20599539141bbff15d.tar.gz
dns: use unix_to_dns_timestamp almost everywhere
In places we change NTTIME to uint32_t, because that is what is actually wanted. There is one instance of the calculation that we are not changing, because there are other problems there. 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/dns_server/dlz_bind9.c6
-rw-r--r--source4/dns_server/dns_update.c6
-rw-r--r--source4/dns_server/dnsserver_common.c6
-rw-r--r--source4/dsdb/kcc/scavenge_dns_records.c6
4 files changed, 6 insertions, 18 deletions
diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c
index 687313b0a78..6f729f46561 100644
--- a/source4/dns_server/dlz_bind9.c
+++ b/source4/dns_server/dlz_bind9.c
@@ -1908,7 +1908,6 @@ _PUBLIC_ isc_result_t dlz_addrdataset(const char *name, const char *rdatastr, vo
uint16_t num_recs = 0;
uint16_t first = 0;
uint16_t i;
- NTTIME t;
WERROR werr;
if (state->transaction_token != (void*)version) {
@@ -1993,10 +1992,7 @@ _PUBLIC_ isc_result_t dlz_addrdataset(const char *name, const char *rdatastr, vo
if (dns_name_is_static(recs, num_recs)) {
rec->dwTimeStamp = 0;
} else {
- unix_to_nt_time(&t, time(NULL));
- t /= 10 * 1000 * 1000; /* convert to seconds */
- t /= 3600; /* convert to hours */
- rec->dwTimeStamp = (uint32_t)t;
+ rec->dwTimeStamp = unix_to_dns_timestamp(time(NULL));
}
}
diff --git a/source4/dns_server/dns_update.c b/source4/dns_server/dns_update.c
index 529ee7894a3..d1e7825bf07 100644
--- a/source4/dns_server/dns_update.c
+++ b/source4/dns_server/dns_update.c
@@ -302,7 +302,6 @@ static WERROR dns_rr_to_dnsp(TALLOC_CTX *mem_ctx,
bool name_is_static)
{
enum ndr_err_code ndr_err;
- NTTIME t;
if (rrec->rr_type == DNS_QTYPE_ALL) {
return DNS_ERR(FORMAT_ERROR);
@@ -316,10 +315,7 @@ static WERROR dns_rr_to_dnsp(TALLOC_CTX *mem_ctx,
if (name_is_static) {
r->dwTimeStamp = 0;
} else {
- unix_to_nt_time(&t, time(NULL));
- t /= 10 * 1000 * 1000;
- t /= 3600;
- r->dwTimeStamp = t;
+ r->dwTimeStamp = unix_to_dns_timestamp(time(NULL));
}
/* If we get QCLASS_ANY, we're done here */
diff --git a/source4/dns_server/dnsserver_common.c b/source4/dns_server/dnsserver_common.c
index 6142d2af406..bc0f8ad6c23 100644
--- a/source4/dns_server/dnsserver_common.c
+++ b/source4/dns_server/dnsserver_common.c
@@ -941,7 +941,7 @@ WERROR dns_common_replace(struct ldb_context *samdb,
bool become_tombstoned = false;
struct ldb_dn *zone_dn = NULL;
struct dnsserver_zoneinfo *zoneinfo = NULL;
- NTTIME t;
+ uint32_t t;
msg = ldb_msg_new(mem_ctx);
W_ERROR_HAVE_NO_MEMORY(msg);
@@ -1015,9 +1015,7 @@ WERROR dns_common_replace(struct ldb_context *samdb,
}
if (zoneinfo->fAging == 1 && records[i].dwTimeStamp != 0) {
- unix_to_nt_time(&t, time(NULL));
- t /= 10 * 1000 * 1000;
- t /= 3600;
+ t = unix_to_dns_timestamp(time(NULL));
if (t - records[i].dwTimeStamp >
zoneinfo->dwNoRefreshInterval) {
records[i].dwTimeStamp = t;
diff --git a/source4/dsdb/kcc/scavenge_dns_records.c b/source4/dsdb/kcc/scavenge_dns_records.c
index 8e916cf7b06..7504d3ac536 100644
--- a/source4/dsdb/kcc/scavenge_dns_records.c
+++ b/source4/dsdb/kcc/scavenge_dns_records.c
@@ -381,7 +381,7 @@ NTSTATUS dns_delete_tombstones(TALLOC_CTX *mem_ctx,
struct dns_server_zone *zones = NULL;
struct dns_server_zone *z = NULL;
int ret, i;
- NTTIME current_time;
+ uint32_t current_time;
enum ndr_err_code ndr_err;
struct ldb_result *res = NULL;
int tombstone_time;
@@ -392,9 +392,7 @@ NTSTATUS dns_delete_tombstones(TALLOC_CTX *mem_ctx,
const char *attrs[] = {"dnsRecord", "dNSTombstoned", NULL};
rec = talloc_zero(mem_ctx, struct dnsp_DnssrvRpcRecord);
- unix_to_nt_time(&current_time, time(NULL));
- current_time /= 10 * 1000 * 1000;
- current_time /= 3600;
+ current_time = unix_to_dns_timestamp(time(NULL));
lp_ctx = (struct loadparm_context *)ldb_get_opaque(samdb, "loadparm");
tombstone_time =