Permalink
Browse files

Item14205: Fix some issues with FCGI, undefined, and Certs

Only the path or file can be passed for the CA Certificate store. Some
verions will reject the connection if both methods are provided.  So if
both exist, us the bundle file if it's available.

The STDERR capture doesn't work on FCGI,  so bypass capturing on that
platform.

Correct some undefined errors.
  • Loading branch information...
gac410 committed Nov 8, 2016
1 parent a5aef45 commit a7b968afa0658814448eeaff769010cc362c6052
@@ -254,7 +254,13 @@ NOCERT
my $err;
if ( $Foswiki::cfg{SMTP}{MAILHOST} ) {
- ( $ok, $out, $err ) = _muteExec( \&_autoconfigSMTP, $reporter );
+
+ if ( $Foswiki::cfg{Engine} && $Foswiki::cfg{Engine} !~ m/FastCGI$/ ) {
+ ( $ok, $out, $err ) = _muteExec( \&_autoconfigSMTP, $reporter );
+ }
+ else {
+ $ok = _autoconfigSMTP($reporter);
+ }
unless ($ok) {
$reporter->WARN(
"SMTP configuration using $Foswiki::cfg{SMTP}{MAILHOST} failed. Falling back to mail program"
@@ -267,14 +273,17 @@ NOCERT
);
}
- $reporter->NOTE($out);
+ $reporter->NOTE($out) if defined $out;
+
if ($err) {
+ if ( $Foswiki::cfg{Engine} && $Foswiki::cfg{Engine} !~ m/CLI$/ ) {
- # Double-space the debug output so that it doesn't wrap.
- $err =~ s/\n/\n\n/sg;
- $err =~ s/\n$//g;
+ # Double-space the debug output so that it doesn't wrap.
+ $err =~ s#\n#<br/>#sg;
+ $err =~ s/\n$//g;
+ }
- $reporter->NOTE( <<OUT );
+ $reporter->NOTE( <<OUT ) if ($err);
======= DEBUG MESSAGES ====
$err
OUT
@@ -85,6 +85,8 @@ sub guess_locations {
}
}
+ return undef if ($guessed);
+
# First see if the linux default path work
foreach $path (@CERT_DIRS) {
if ( -d $path && -r $path ) {
@@ -111,7 +113,7 @@ sub _setLocations {
$Foswiki::cfg{Email}{SSLCaFile} = $_[1];
$_[0]->CHANGED('{Email}{SSLCaFile}');
}
- if ( $_[2] ) {
+ elsif ( $_[2] ) {
$Foswiki::cfg{Email}{SSLCaPath} = $_[2];
$_[0]->CHANGED('{Email}{SSLCaPath}');
}
View
@@ -64,7 +64,7 @@ require Foswiki::Configure::Query;
sub NOTE {
my $this = shift;
- my $text = join( "\n", @_ ) . "\n";
+ my $text = join( "\n", @_ ) . "\n" if ( scalar @_ );
$this->{notes}++;
# Take out block formatting tags

0 comments on commit a7b968a

Please sign in to comment.