* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.37 2011/03/09 23:47:17 tbox Exp $ */
+/* $Id: time.c,v 1.38 2012/01/27 01:43:51 marka Exp $ */
/*! \file */
return (ISC_R_SUCCESS);
}
-isc_result_t
-dns_time32_totext(isc_uint32_t value, isc_buffer_t *target) {
+isc_int64_t
+dns_time64_from32(isc_uint32_t value) {
isc_stdtime_t now;
isc_int64_t start;
isc_int64_t t;
t = start + (value - now);
else
t = start - (now - value);
- return (dns_time64_totext(t, target));
+
+ return (t);
+}
+
+isc_result_t
+dns_time32_totext(isc_uint32_t value, isc_buffer_t *target) {
+ return (dns_time64_totext(dns_time64_from32(value), target));
}
isc_result_t
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.664 2012/01/25 23:46:49 tbox Exp $ */
+/* $Id: zone.c,v 1.665 2012/01/27 01:43:51 marka Exp $ */
/*! \file */
#include <dns/soa.h>
#include <dns/ssu.h>
#include <dns/stats.h>
+#include <dns/time.h>
#include <dns/tsig.h>
#include <dns/update.h>
#include <dns/xfrin.h>
}
static void
-set_key_expiry_warning(dns_zone_t *zone, isc_stdtime_t when, isc_stdtime_t now)
+set_key_expiry_warning(dns_zone_t *zone, isc_uint64_t when, isc_stdtime_t now)
{
unsigned int delta;
char timebuf[80];
unsigned int i;
dns_rdata_rrsig_t rrsig;
isc_boolean_t found, changed;
- isc_stdtime_t warn = 0, maybe = 0;
+ isc_int64_t warn = 0, maybe = 0;
dns_rdataset_init(&rdataset);
* iff there is a new offline signature.
*/
if (!dst_key_isprivate(keys[i])) {
- if (warn != 0 &&
- warn > rrsig.timeexpire)
- warn = rrsig.timeexpire;
+ isc_int64_t timeexpire =
+ dns_time64_from32(rrsig.timeexpire);
+ if (warn != 0 && warn > timeexpire)
+ warn = timeexpire;
if (rdata.flags & DNS_RDATA_OFFLINE) {
if (maybe == 0 ||
- maybe > rrsig.timeexpire)
- maybe =
- rrsig.timeexpire;
+ maybe > timeexpire)
+ maybe = timeexpire;
break;
}
if (warn == 0)
warn = maybe;
- if (warn == 0 ||
- warn > rrsig.timeexpire)
- warn = rrsig.timeexpire;
+ if (warn == 0 || warn > timeexpire)
+ warn = timeexpire;
result = offline(db, ver, diff, name,
rdataset.ttl, &rdata);
break;
dns_rdataset_disassociate(&rdataset);
if (result == ISC_R_NOMORE)
result = ISC_R_SUCCESS;
- if (warn != 0)
- set_key_expiry_warning(zone, warn, now);
+ if (warn > 0) {
+#if defined(STDTIME_ON_32BITS)
+ isc_stdtime_t stdwarn = (isc_stdtime_t)warn;
+ if (warn == stdwarn)
+#endif
+ set_key_expiry_warning(zone, (isc_stdtime_t)warn, now);
+#if defined(STDTIME_ON_32BITS)
+ else
+ dns_zone_log(zone, ISC_LOG_ERROR,
+ "key expiry warning time out of range");
+#endif
+ }
failure:
if (node != NULL)
dns_db_detachnode(db, &node);