X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fmk-ca-bundle.pl;h=0b1331840f943a29317e0df3fa3af4f8f4416a3b;hb=7a9f915fa6be8c8955ff2c59169538a4d0349080;hp=c2080e9525b9dd9404632bbbefa77b3a03b90f7f;hpb=2bc9d6bb53df44a0c5174767de734620c2cdfd9e;p=platform%2Fupstream%2Fcurl.git diff --git a/lib/mk-ca-bundle.pl b/lib/mk-ca-bundle.pl index c2080e9..0b13318 100755 --- a/lib/mk-ca-bundle.pl +++ b/lib/mk-ca-bundle.pl @@ -185,12 +185,6 @@ sub VERSION_MESSAGE() { 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; @@ -284,20 +278,20 @@ my $fetched; my $oldsha1 = oldsha1($crt); -report "SHA1 of old file: $oldsha1"; +print STDERR "SHA1 of old file: $oldsha1\n" if (!$opt_q); -report "Downloading '$txt' ..."; +print STDERR "Downloading '$txt' ...\n" if (!$opt_q); if($curl && !$opt_n) { my $https = $url; $https =~ s/^http:/https:/; - report "Get certdata over HTTPS with curl!"; + print STDERR "Get certdata over HTTPS with curl!\n" if (!$opt_q); my $quiet = $opt_q ? "-s" : ""; my @out = `curl -w %{response_code} $quiet -O $https`; if(@out && $out[0] == 200) { $fetched = 1; } else { - report "Failed downloading HTTPS with curl, trying HTTP with LWP"; + print STDERR "Failed downloading HTTPS with curl, trying HTTP with LWP\n" if (!$opt_q); } } @@ -306,14 +300,15 @@ unless ($fetched || ($opt_n and -e $txt)) { $ua->env_proxy(); $resp = $ua->mirror($url, $txt); if ($resp && $resp->code eq '304') { - report "Not modified"; + print STDERR "Not modified\n" unless $opt_q; exit 0 if -e $crt && !$opt_f; } else { $fetched = 1; } if( !$resp || $resp->code !~ /^(?:200|304)$/ ) { - report "Unable to download latest data: " - . ($resp? $resp->code . ' - ' . $resp->message : "LWP failed"); + print STDERR "Unable to download latest data: " + . ($resp? $resp->code . ' - ' . $resp->message : "LWP failed") . "\n" + unless $opt_q; exit 1 if -e $crt || ! -r $txt; } } @@ -330,11 +325,11 @@ if(!$filedate) { my $newsha1= sha1($txt); if(!$opt_f && $oldsha1 eq $newsha1) { - report "Downloaded file identical to previous run\'s source file. Exiting"; + print STDERR "Downloaded file identical to previous run\'s source file. Exiting\n"; exit; } -report "SHA1 of new file: $newsha1"; +print STDERR "SHA1 of new file: $newsha1\n"; my $currentdate = scalar gmtime($filedate); @@ -366,7 +361,7 @@ print CRT <) { 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) ) { - report "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2"; + print STDERR "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2\n" if (!$opt_q); } elsif ( !is_in_list($2,@valid_mozilla_trust_levels) ) { - report "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2"; + print STDERR "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2\n" if (!$opt_q); } else { push @{$trust_purposes_by_level{$2}}, $1; } @@ -475,7 +470,7 @@ while () { open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!"; } } - report "Parsing: $caname" if ($opt_v); + print STDERR "Parsing: $caname\n" if ($opt_v); $certnum ++; $start_of_cert = 0; } @@ -496,4 +491,4 @@ unless( $stdout ) { rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n"; } unlink $txt if ($opt_u); -report "Done ($certnum CA certs processed, $skipnum skipped)."; +print STDERR "Done ($certnum CA certs processed, $skipnum skipped).\n" if (!$opt_q);