Skip to content

Commit

Permalink
[ca_bundle] Updated to version 7.47.1
Browse files Browse the repository at this point in the history
  • Loading branch information
apepper committed Mar 7, 2016
1 parent 7fe216d commit 7e013f6
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions tasks/support/ca_bundle.pl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# *
# * This software is licensed as described in the file COPYING.ca_bundle, which
# * you should have received as part of this distribution. The terms
# * are also available at http://curl.haxx.se/docs/copyright.html.
# * are also available at https://curl.haxx.se/docs/copyright.html.
# *
# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
# * copies of the Software, and permit persons to whom the Software is
Expand Down Expand Up @@ -185,6 +185,12 @@ ()
warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i );
HELP_MESSAGE() if ($opt_h);

sub report($@) {
my $output = shift;

print STDERR $output . "\n" unless $opt_q;
}

sub is_in_list($@) {
my $target = shift;

Expand Down Expand Up @@ -278,20 +284,20 @@ (%)

my $oldsha1 = oldsha1($crt);

print STDERR "SHA1 of old file: $oldsha1\n" if (!$opt_q);
report "SHA1 of old file: $oldsha1";

print STDERR "Downloading '$txt' ...\n" if (!$opt_q);
report "Downloading '$txt' ...";

if($curl && !$opt_n) {
my $https = $url;
$https =~ s/^http:/https:/;
print STDERR "Get certdata over HTTPS with curl!\n" if (!$opt_q);
report "Get certdata over HTTPS with curl!";
my $quiet = $opt_q ? "-s" : "";
my @out = `curl -w %{response_code} $quiet -O $https`;
if(@out && $out[0] == 200) {
$fetched = 1;
} else {
print STDERR "Failed downloading HTTPS with curl, trying HTTP with LWP\n" if (!$opt_q);
report "Failed downloading HTTPS with curl, trying HTTP with LWP";
}
}

Expand All @@ -300,15 +306,14 @@ (%)
$ua->env_proxy();
$resp = $ua->mirror($url, $txt);
if ($resp && $resp->code eq '304') {
print STDERR "Not modified\n" unless $opt_q;
report "Not modified";
exit 0 if -e $crt && !$opt_f;
} else {
$fetched = 1;
}
if( !$resp || $resp->code !~ /^(?:200|304)$/ ) {
print STDERR "Unable to download latest data: "
. ($resp? $resp->code . ' - ' . $resp->message : "LWP failed") . "\n"
unless $opt_q;
report "Unable to download latest data: "
. ($resp? $resp->code . ' - ' . $resp->message : "LWP failed");
exit 1 if -e $crt || ! -r $txt;
}
}
Expand All @@ -324,12 +329,12 @@ (%)
# get the hash from the download file
my $newsha1= sha1($txt);

if($oldsha1 eq $newsha1) {
print STDERR "Downloaded file identical to previous run\'s source file. Exiting\n";
if(!$opt_f && $oldsha1 eq $newsha1) {
report "Downloaded file identical to previous run\'s source file. Exiting";
exit;
}

print STDERR "SHA1 of new file: $newsha1\n";
report "SHA1 of new file: $newsha1";

my $currentdate = scalar gmtime($filedate);

Expand Down Expand Up @@ -361,7 +366,7 @@ (%)
EOT

print STDERR "Processing '$txt' ...\n" if (!$opt_q);
report "Processing '$txt' ...";
my $caname;
my $certnum = 0;
my $skipnum = 0;
Expand Down Expand Up @@ -413,9 +418,9 @@ (%)
last if (/^#/);
if (/^CKA_TRUST_([A-Z_]+)\s+CK_TRUST\s+CKT_NSS_([A-Z_]+)\s*$/) {
if ( !is_in_list($1,@valid_mozilla_trust_purposes) ) {
print STDERR "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2\n" if (!$opt_q);
report "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2";
} elsif ( !is_in_list($2,@valid_mozilla_trust_levels) ) {
print STDERR "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2\n" if (!$opt_q);
report "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2";
} else {
push @{$trust_purposes_by_level{$2}}, $1;
}
Expand Down Expand Up @@ -470,7 +475,7 @@ (%)
open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
}
}
print STDERR "Parsing: $caname\n" if ($opt_v);
report "Parsing: $caname" if ($opt_v);
$certnum ++;
$start_of_cert = 0;
}
Expand All @@ -491,4 +496,4 @@ (%)
rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n";
}
unlink $txt if ($opt_u);
print STDERR "Done ($certnum CA certs processed, $skipnum skipped).\n" if (!$opt_q);
report "Done ($certnum CA certs processed, $skipnum skipped).";

0 comments on commit 7e013f6

Please sign in to comment.