]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Multiple fixes regarding the serial-arithmetic time formating from the previous commit.
authorWillem Toorop <willem@NLnetLabs.nl>
Mon, 14 Mar 2011 14:29:26 +0000 (14:29 +0000)
committerWillem Toorop <willem@NLnetLabs.nl>
Mon, 14 Mar 2011 14:29:26 +0000 (14:29 +0000)
B.t.w. the problem was first defined in bug #359.

Makefile.in
install-sh
ldns/util.h.in
util.c

index 6e0ce40641bc241be67975611e7fcb076f38cc89..8b769d23f57e886a58dabd4469246a4ed024d22c 100644 (file)
@@ -56,7 +56,7 @@ LINT          = splint
 LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list
 #-Dglob64=glob -Dglobfree64=globfree
 # compat with openssl linux edition.
-LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -D"EC_KEY=unsigned" -D"EC_POINT=unsigned" -D"EC_GROUP=unsigned"
+LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -D"EC_KEY=unsigned" -D"EC_POINT=unsigned" -D"EC_GROUP=unsigned" -D"EVP_PKEY_ASN1_METHOD=struct evp_pkey_asn1_method_st" -D"EVP_PKEY_CTX=struct evp_pkey_ctx_st"
 # compat with NetBSD
 ifeq "$(shell uname)" "NetBSD"
 LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_
index 6781b987bdbcbc23efe6bbe1654a1e3637b9af07..3f83ce9b555a535ca90c450882953554c7e4ded5 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2010-02-06.18; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -200,7 +200,11 @@ if test $# -eq 0; then
 fi
 
 if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
index e9af95f673c94bf71045572b0bf4e5183f015458..7ddd4f4b887ed410c7614d134c6cdbb73a7800c5 100644 (file)
@@ -268,6 +268,21 @@ const char * ldns_version(void);
  */
 time_t mktime_from_utc(const struct tm *tm);
 
+/**
+ * The function interprets time as the number of seconds since epoch
+ * with respect to now using serial arithmitics (rfc1982).
+ * That number of seconds is then converted to broken-out time information.
+ * This is especially usefull when converting the inception and expiration
+ * fields of RRSIG records.
+ * \param[in] time number of seconds since epoch (midnight, January 1st, 1970)
+ * to be intepreted as a serial arithmitics number relative to now.
+ * \param[in] now number of seconds since epoch (midnight, January 1st, 1970)
+ * to which the time value is compared to determine the final value.
+ * \param[out] result the struct with the broken-out time information
+ * \return result on success or NULL on error
+ */
+struct tm * serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result);
 /**
  * Seed the random function.
  * If the file descriptor is specified, the random generator is seeded with
diff --git a/util.c b/util.c
index ff342e6db23da53c0f445791ea26b66817794ea3..8a7fe2ebdc66e02c2b46cef912594d9c4c57cb08 100644 (file)
--- a/util.c
+++ b/util.c
@@ -326,11 +326,12 @@ serial_arithmitics_time(int32_t time, time_t now)
 struct tm *
 serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result)
 {
-       int64_t secs_since_epoch = serial_arithmitics_time(time, now);
 #if SIZEOF_TIME_T <= 4
-       return ldns_gmtime64_r(secs_since_epoch, result);
+       int64_t secs_since_epoch = serial_arithmitics_time(time, now);
+       return  ldns_gmtime64_r(secs_since_epoch, result);
 #else
-       return gmtime_r(& (time_t) secs_since_epoch, result);
+       time_t  secs_since_epoch = serial_arithmitics_time(time, now);
+       return  gmtime_r(&secs_since_epoch, result);
 #endif
 }