From: Alan T. DeKok Date: Tue, 3 Mar 2020 02:09:09 +0000 (-0500) Subject: call timegm for UTC times. Fixes #3304 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55fc4dfe1962ac91dd6eeb224e7f26e5615dfed2;p=thirdparty%2Ffreeradius-server.git call timegm for UTC times. Fixes #3304 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. --- diff --git a/src/lib/tls/utils.c b/src/lib/tls/utils.c index 94d1f437bbe..799225fda4b 100644 --- a/src/lib/tls/utils.c +++ b/src/lib/tls/utils.c @@ -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; }