Commit 0cc787b9 authored by Leigh B Stoller's avatar Leigh B Stoller

Bug Fix; the unapproved certs need to go into the local

directory so that the new site can talk to the CH.
parent a77fd940
......@@ -61,6 +61,7 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Protos
sub fatal($);
sub SplitCertBundle($);
#
# Turn off line buffering on output
......@@ -129,31 +130,9 @@ system("/bin/mv -f /tmp/wwwbundle.$$ $WWWBUNDLE") == 0
#
# Split up the extra certs.
#
my @certs = ();
my $certstr;
if( open( BUNDLE, "$TB/etc/extracerts.bundle" ) ) {
while (<BUNDLE>) {
if ($_ =~ /^-----BEGIN CERT/) {
$certstr = $_;
next;
}
if ($_ =~ /^-----END CERT/) {
$certstr .= $_;
push(@certs, $certstr);
$certstr = undef;
next;
}
if ($certstr) {
$certstr .= $_;
next;
}
}
# If the file is properly terminated, there should be no certificate in
# progress. Hopefully the file is not trashed at a boundry.
fatal("Trashed bundle file")
if ($certstr);
close(BUNDLE);
my @certs = SplitCertBundle("$TB/etc/extracerts.bundle");
if (-s "$TB/etc/unapproved.bundle") {
@certs = (@certs, SplitCertBundle("$TB/etc/unapproved.bundle"));
}
mkdir("/tmp/extracerts.$$", 0755) or
......@@ -195,3 +174,39 @@ sub fatal($)
die("*** $0:\n".
" $msg\n");
}
#
# Split up a bundle and return list of certs.
#
sub SplitCertBundle($)
{
my ($filename) = @_;
my @certs = ();
my $certstr;
if (open(BUNDLE, $filename)) {
while (<BUNDLE>) {
if ($_ =~ /^-----BEGIN CERT/) {
$certstr = $_;
next;
}
if ($_ =~ /^-----END CERT/) {
$certstr .= $_;
push(@certs, $certstr);
$certstr = undef;
next;
}
if ($certstr) {
$certstr .= $_;
next;
}
}
# If the file is properly terminated, there should be no certificate in
# progress. Hopefully the file is not trashed at a boundry.
fatal("Trashed bundle file: $filename")
if ($certstr);
close(BUNDLE);
}
return @certs;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment