diff options
-rw-r--r-- | Makefile.PL | 2 | ||||
-rwxr-xr-x | acmeman | 20 | ||||
-rw-r--r-- | lib/App/Acmeman/Domain.pm | 5 |
3 files changed, 14 insertions, 13 deletions
diff --git a/Makefile.PL b/Makefile.PL index edb81a9..dab6494 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -15,7 +15,7 @@ use ExtUtils::AutoInstall ( 'Crypt::Format' => 0.06, 'Crypt::OpenSSL::PKCS10' => 0.16, 'Crypt::OpenSSL::RSA' => 0.28, - 'Crypt::OpenSSL::X509' => 1.807, + 'Crypt::OpenSSL::X509' => 1.808, 'DateTime::Format::Strptime' => 1.42, 'LWP::UserAgent' => 6.15, 'LWP::Protocol::https' => 6.07, @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#!/usr/bin/perl # Copyright (C) 2017, 2018 Sergey Poznyakoff <gray@gnu.org> # # This program is free software; you can redistribute it and/or modify @@ -653,14 +653,11 @@ sub domain_cert_expires { if (exists($exts->{subjectAltName})) { my $msg = $config->get(qw(core check-alt-names)) ? 'will renew' : 'use -a to trigger renewal'; - # FIXME: Crypt::OpenSSL::X509 returns extensions as strings, - # instead of as ASN.1 objects. Until it is fixed, the - # following naive logic is implemented to split the string into - # names: - my $blob = $exts->{subjectAltName}->value(); + my @names = map { s/^DNS://; $_ } + split /,\s*/, $exts->{subjectAltName}->to_string(); my @missing; foreach my $vh (sort { length($b) <=> length($a) } $domain->names) { - unless ($blob =~ s/\Q$vh\E\b//) { + unless (grep { $_ eq $vh } @names) { push @missing, $vh; } } @@ -841,7 +838,7 @@ sub coalesce { foreach my $ent (sort { $a->{domain} cmp $b->{domain} } map { { ord => $i++, domain => $_ } } @{$ref}) { if (@domlist && $domlist[-1]->{domain}->cn eq $ent->{domain}->cn) { - $domlist[-1] += $ent; + $domlist[-1]->{domain} += $ent->{domain}; } else { push @domlist, $ent; } @@ -917,7 +914,8 @@ sub cb_parse_bool { true => 1, yes => 1 ); - if (my $res = $bt{lc($$vref)}) { + my $res = $bt{lc($$vref)}; + if (defined($res)) { $$vref = $res; return undef; } @@ -933,7 +931,7 @@ my %syntax = ( 'time-delta' => { default => 86400 }, source => { default => 'apache' }, 'check-alt-names' => { default => 0, parser => \&cb_parse_bool }, - 'key-size' => { re => '^\d+$', default => 4096 } + 'key-size' => { re => '^\d+$', default => 4096 } } }, files => { @@ -1030,7 +1028,7 @@ $config = new App::Acmeman::Config($config_file, syntax => \%syntax, defaults => { 'core.source' => 'apache', - 'core.key-size' => 4096, + 'core.key-size' => 4096 }); if ($config->success) { diff --git a/lib/App/Acmeman/Domain.pm b/lib/App/Acmeman/Domain.pm index 64d4275..203e63c 100644 --- a/lib/App/Acmeman/Domain.pm +++ b/lib/App/Acmeman/Domain.pm @@ -3,6 +3,7 @@ package App::Acmeman::Domain; use strict; use warnings; use Carp; +use Clone; require Exporter; our @ISA = qw(Exporter); @@ -97,14 +98,16 @@ sub _domain_plus { carp "righthand-side argument should be a App::Acmeman::Domain" unless $b->isa('App::Acmeman::Domain'); + $a = Clone::clone($a); push @{$a->{_alt}}, $b->cn unless $a->contains($b->cn); @{$a->{_alt}} = uniq($a->alt, $b->alt); + return $a; } use overload cmp => \&_domain_cmp, - '+' => \&domain_plus, + '+' => \&_domain_plus, '""' => sub { $_[0]->cn }; sub cn { |