1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Fixed lost OpenSSL output with "-t" - followup.

The previously applied patch didnt work on Windows; we cant rely
on shell commands like 'echo' since they act diffently on each
platform and each shell.
In order to keep this script platform-independent the code must
only use pure Perl.
This commit is contained in:
Guenter Knauf 2013-04-10 00:20:37 +02:00
parent f8da49eec0
commit 577703495e

View File

@ -124,7 +124,7 @@ print CRT <<EOT;
## This is a bundle of X.509 certificates of public Certificate Authorities ## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates ## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree: ## file (certdata.txt). This file can be found in the mozilla source tree:
## $url ## ${url}
## ##
## It contains the certificates in ${format}PEM format and therefore ## It contains the certificates in ${format}PEM format and therefore
## can be directly used with curl / libcurl / php_curl, or with ## can be directly used with curl / libcurl / php_curl, or with
@ -201,11 +201,18 @@ while (<TXT>) {
print CRT ("=" x length($caname) . "\n"); print CRT ("=" x length($caname) . "\n");
if (!$opt_t) { if (!$opt_t) {
print CRT $pem; print CRT $pem;
} } else {
if ($opt_t) { my $pipe = "|$openssl x509 -md5 -fingerprint -text -inform PEM";
my $openssl_output = `echo '$pem' | $openssl x509 -md5 -fingerprint -text -inform PEM` or if (!$stdout) {
die "Couldn't run openssl : $?\n"; $pipe .= " >> $crt.~";
print CRT $openssl_output; close(CRT) or die "Couldn't close $crt.~: $!";
}
open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
print TMP $pem;
close(TMP) or die "Couldn't close openssl pipe: $!";
if (!$stdout) {
open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
}
} }
print STDERR "Parsing: $caname\n" if ($opt_v); print STDERR "Parsing: $caname\n" if ($opt_v);
$certnum ++; $certnum ++;