aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-01-21 02:13:06 +0100
committerGuilhem Moulin <guilhem@fripost.org>2019-01-21 02:13:06 +0100
commit57ddc5ca505adeb3e44542335b01a6f0e8887ddc (patch)
treeb5cf1f36dbf6a3b14fd6eb807087b66d69df1655
parentd5d7aed46cc34dfbba521dc216f6f75a4309de10 (diff)
lacme, client: new dependency Date::Parse.
-rw-r--r--Changelog2
-rwxr-xr-xclient2
-rwxr-xr-xlacme29
3 files changed, 5 insertions, 28 deletions
diff --git a/Changelog b/Changelog
index 31ad97d..43265ce 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,8 @@
lacme (0.6) UNRELEASED
+ client: poll order URL instead of each authz URL successively.
+ - lacme, client: new dependency Date::Parse, don't parse RFC 3339
+ datetime strings from X.509 certs manually.
-- Guilhem Moulin <guilhem@fripost.org> Mon, 21 Jan 2019 02:07:58 +0100
diff --git a/client b/client
index 9ce52a0..c152e30 100755
--- a/client
+++ b/client
@@ -50,6 +50,7 @@ use Fcntl qw/O_CREAT O_EXCL O_WRONLY/;
use Digest::SHA qw/sha256 sha256_hex/;
use MIME::Base64 qw/encode_base64 encode_base64url/;
+use Date::Parse ();
use LWP::UserAgent ();
use Types::Serialiser ();
use JSON ();
@@ -148,7 +149,6 @@ sub request_retry_after($) {
my $r = shift;
my $v = $r->header('Retry-After');
if (defined $v and $v !~ /\A\d+\z/) {
- require 'Date/Parse.pm';
$v = Date::Parse::str2time($v);
if (defined $v) {
$v = $v - time;
diff --git a/lacme b/lacme
index 3e5347d..cc94149 100755
--- a/lacme
+++ b/lacme
@@ -36,6 +36,7 @@ use Socket 1.95 qw/AF_UNIX AF_INET AF_INET6 PF_UNIX PF_INET PF_INET6 PF_UNSPEC
SOCK_STREAM SOL_SOCKET SO_REUSEADDR SHUT_RDWR/;
use Config::Tiny ();
+use Date::Parse ();
use Net::SSLeay ();
# Clean up PATH
@@ -199,33 +200,7 @@ sub x509_enddate($) {
$time = Net::SSLeay::X509_get_notAfter($x509) if defined $x509;
$dt = Net::SSLeay::P_ASN1_TIME_get_isotime($time) if defined $time;
- my $t;
- if (defined $dt and $dt =~ s/\A(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})//) {
- # RFC3339 datetime strings; assume epoch is on January 1 of $epoch_year
- my ($y, $m, $d, $h, $min, $s) = ($1, $2, $3, $4, $5, $6);
- my (undef,undef,undef,undef,undef,$epoch_year,undef,undef,undef) = gmtime(0);
- $t = 0;
- foreach (($epoch_year+1900) .. $y-1) {
- $t += 365*86400;
- $t += 86400 if ($_ % 4 == 0 and $_ % 100 != 0) or ($_ % 400 == 0); # leap
- }
-
- if ($m > 1) {
- my @m = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
- $m[1]++ if ($y % 4 == 0 and $y % 100 != 0) or ($y % 400 == 0); # leap
- $t += 86400*$m[$_] for (0 .. $m-2);
- }
-
- $t += 86400*($d-1);
- $t += $s + 60*($min + 60*$h);
-
- $dt =~ s/\A\.(\d{1,9})\d*//; # ignore nanosecs
-
- if ($dt =~ /\A([+-])(\d{2}):(\d{2})\z/) {
- my $tz = 60*($3 + 60*$2);
- $t = $1 eq '-' ? ($t+$tz) : ($t-$tz);
- }
- }
+ my $t = Date::Parse::str2time($dt) if defined $dt;
Net::SSLeay::X509_free($x509) if defined $x509;
Net::SSLeay::BIO_free($bio) if defined $bio;