]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
CRL: use time_t instead of struct timespec to store last mtime
authorAntonio Quartulli <a@unstable.cc>
Thu, 16 Mar 2017 08:21:17 +0000 (16:21 +0800)
committerGert Doering <gert@greenie.muc.de>
Thu, 16 Mar 2017 08:27:44 +0000 (09:27 +0100)
As of now, we store the last mtime for the CRL file in a timespec
object. However we store seconds only and we ignore the subsecond
field (this came into being because not all platforms have nanoseconds
precision in timespec).

Given the above, we can safely replace the timespec object with a
simple time_t.

Reported-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20170316082117.21020-1-a@unstable.cc>
URL: http://www.mail-archive.com/search?l=mid&q=20170316082117.21020-1-a@unstable.cc
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/ssl.c
src/openvpn/ssl_mbedtls.h
src/openvpn/ssl_openssl.h

index beee82f59149b54972988cfe5ff25ac1fd7169af..fca1e7c530ac7586b784bd1f721e296212714380 100644 (file)
@@ -571,12 +571,12 @@ tls_ctx_reload_crl(struct tls_root_ctx *ssl_ctx, const char *crl_file,
      * Note: Windows does not support tv_nsec.
      */
     if ((ssl_ctx->crl_last_size == crl_stat.st_size)
-        && (ssl_ctx->crl_last_mtime.tv_sec == crl_stat.st_mtime))
+        && (ssl_ctx->crl_last_mtime == crl_stat.st_mtime))
     {
         return;
     }
 
-    ssl_ctx->crl_last_mtime.tv_sec = crl_stat.st_mtime;
+    ssl_ctx->crl_last_mtime = crl_stat.st_mtime;
     ssl_ctx->crl_last_size = crl_stat.st_size;
     backend_tls_ctx_reload_crl(ssl_ctx, crl_file, crl_file_inline);
 }
index 1bc53ce8e261ba1194142f5eeed2c1e17ff78782..d8f717ce1bd58a54cdab77fd7ba2e69192a0b1a6 100644 (file)
@@ -74,7 +74,7 @@ struct tls_root_ctx {
     mbedtls_x509_crt *ca_chain;         /**< CA chain for remote verification */
     mbedtls_pk_context *priv_key;       /**< Local private key */
     mbedtls_x509_crl *crl;              /**< Certificate Revocation List */
-    struct timespec crl_last_mtime;     /**< CRL last modification time */
+    time_t crl_last_mtime;              /**< CRL last modification time */
     off_t crl_last_size;                /**< size of last loaded CRL */
 #if defined(ENABLE_PKCS11)
     mbedtls_pkcs11_context *priv_key_pkcs11;    /**< PKCS11 private key */
index c64c65f812281aa205734e373382001a72d7e16d..6ca4cb6de4399f8f174f80d4e83c39bd4d6285f3 100644 (file)
@@ -49,7 +49,7 @@
  */
 struct tls_root_ctx {
     SSL_CTX *ctx;
-    struct timespec crl_last_mtime;
+    time_t crl_last_mtime;
     off_t crl_last_size;
 };