]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
call timegm for UTC times. Fixes #3304
authorAlan T. DeKok <aland@freeradius.org>
Tue, 3 Mar 2020 02:09:09 +0000 (21:09 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 3 Mar 2020 02:10:06 +0000 (21:10 -0500)
https://www.openssl.org/docs/man1.1.0/man3/ASN1_TIME_set_string.html

says:

ASN1_TIME_print() currently does not print out the time zone: it either prints out "GMT" or nothing. But all certificates complying with RFC5280 et al use GMT anyway.

src/lib/tls/utils.c

index 94d1f437bbe8b12e0e96bb39a0a52f21e7ddbd59..799225fda4b69d909fe8bdd57c38e7038102d74b 100644 (file)
@@ -192,9 +192,9 @@ int tls_utils_asn1time_to_epoch(time_t *out, ASN1_TIME const *asn1)
        t.tm_sec = (*(p++) - '0') * 10;
        t.tm_sec += (*(p++) - '0');
 
-       /* ASN1_TIME is UTC, but mktime will treat it as being in the local timezone */
+       /* ASN1_TIME is UTC, so get the UTC time */
 done:
-       *out = mktime(&t) + timezone;
+       *out = timegm(&t);
 
        return 0;
 }