Skip to content

Commit

Permalink
correction for openssl_x509_parse vs. UTC
Browse files Browse the repository at this point in the history
Summary:
While testing HHVM on a different machine I noticed a regression failure in
hphp/test/zend/good/ext/openssl/tests/openssl_x509_parse_basic.php

side-by-side testing with gdb on the two systems working/not working shows that
down in the extension the certificate is parsed the same way until the final daylight
savings time adjustment.  The difference between the two systems was the timezone
setting.  There should be no adjustment when the system setting is UTC.

BEFORE
======
root@xyzzy:/mnt/cdn/hhvm/hhvm# timedatectl set-timezone UTC
root@xyzzy:/mnt/cdn/hhvm/hhvm# timedatectl
      Local time: Fri 2017-04-14 16:02:42 UTC
  Universal time: Fri 2017-04-14 16:02:42 UTC
        RTC time: Fri 2017-04-14 15:15:04
       Time zone: UTC (UTC, +0000)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

root@xyzzy:/mnt/cdn/hhvm/hhvm# /mnt/cdn/hhvm/hhvm/hphp/hhvm/hhvm /mnt/cdn/hhvm/hhvm/hphp/test/run  /mnt/cdn/hhvm/hhvm/hphp/test/zend/good/ex
Closes #7785

Differential Revision: D4891689

Pulled By: Orvid

fbshipit-source-id: 7d0c6448134676e594a59c003673c37d77a9d560
  • Loading branch information
swalk-cavium authored and hhvm-bot committed May 13, 2017
1 parent d2caaa1 commit 0dfa55b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hphp/runtime/ext/openssl/ext_openssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2553,7 +2553,8 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME *timestr) {
gmadjust = -(thetime.tm_isdst ?
(long)timezone - 3600 : (long)timezone);
#endif
ret += gmadjust;
/* no adjustment for UTC */
if (timezone) ret += gmadjust;
free(strbuf);
return ret;
}
Expand Down

0 comments on commit 0dfa55b

Please sign in to comment.