Skip to content

Commit

Permalink
Item14221: Merge branch 'Release02x01'
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Dec 5, 2016
2 parents 904ec23 + 3bb6f66 commit bed56ea
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 57 deletions.
15 changes: 2 additions & 13 deletions FastCGIEngineContrib/lib/Foswiki/Engine/FastCGI.pm
Expand Up @@ -65,17 +65,7 @@ sub run {
or die "Failed to create FastCGI socket: $!";
}
$args ||= {};

# Prepare output handles for FastCGI.
$this->{$_} = IO::Handle->new foreach qw(fhOUT fhERR);

# This is a little trick to make all `print STDERR' clauses send their
# output to the log file. May not work for spawned processes.

STDERR->fdopen( $this->{fhERR}->fileno, "w" );

my $r =
FCGI::Request( \*STDIN, $this->{fhOUT}, $this->{fhERR}, \%ENV, $sock,
my $r = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, $sock,
&FCGI::FAIL_ACCEPT_ON_INTR );
my $manager;

Expand Down Expand Up @@ -197,8 +187,7 @@ sub preparePath {
}

sub write {
my $this = shift;
syswrite $this->{fhOUT}, $_[0];
syswrite STDOUT, $_[1];
}

sub closeSocket {
Expand Down
14 changes: 7 additions & 7 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/MANIFEST
Expand Up @@ -679,13 +679,13 @@ pub/System/JQueryPlugin/plugins/treeview/jquery.treeview.js.gz 0644
pub/System/JQueryPlugin/plugins/treeview/jquery.treeview.uncompressed.css 0644
pub/System/JQueryPlugin/plugins/treeview/jquery.treeview.uncompressed.js 0644
pub/System/JQueryPlugin/plugins/treeview/Makefile 0644
pub/System/JQueryPlugin/plugins/tmpl/Makefile
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl-loader.js
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl-loader.js.gz
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl-loader.uncompressed.js
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl.js
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl.js.gz
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl.uncompressed.js
pub/System/JQueryPlugin/plugins/tmpl/Makefile 0644
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl-loader.js 0644
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl-loader.js.gz 0644
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl-loader.uncompressed.js 0644
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl.js 0644
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl.js.gz 0644
pub/System/JQueryPlugin/plugins/tmpl/jquery.tmpl.uncompressed.js 0644
pub/System/JQueryPlugin/plugins/ui/i18n/datepicker-af.js 0644
pub/System/JQueryPlugin/plugins/ui/i18n/datepicker-ar-DZ.js 0644
pub/System/JQueryPlugin/plugins/ui/i18n/datepicker-ar.js 0644
Expand Down
2 changes: 2 additions & 0 deletions core/lib/Foswiki.spec
Expand Up @@ -1920,6 +1920,7 @@ $Foswiki::cfg{Email}{SSLVerifyServer} = $FALSE;

# **PATH LABEL="Certificate Authorities Filename" \
# FEEDBACK="icon='ui-icon-shuffle';label='Guess certificate locations'; wizard='SSLCertificates'; method='guess_locations'"\
# CHECK_ON_CHANGE="{Email}{SSLCaPath}" CHECK="also:{Email}{SSLCaPath}" \
# DISPLAY_IF="{EnableEmail} && /^Net::SMTP/.test({Email}{MailMethod}) && {Email}{SSLVerifyServer}"**
# Specify the file used to verify the server certificate trust chain.
# This is the list of root Certificate authorities that you trust to issue
Expand All @@ -1931,6 +1932,7 @@ $Foswiki::cfg{Email}{SSLCaFile} = '';
# FEEDBACK='label="Validate Contents"; wizard="SSLCertificates"; method="validate";\
# title="Examines every file in the directory and verifies \
# that the contents look like certificates/and/or CRLs"' \
# CHECK_ON_CHANGE="{Email}{SSLCaFile}" CHECK="also:{Email}{SSLCaFile}" \
# DISPLAY_IF="{EnableEmail} && /^Net::SMTP/.test({Email}{MailMethod}) && {Email}{SSLVerifyServer}"**
# Specify the directory used to verify the server certificate trust chain.
# This is the list of root Certificate authorities that you trust to issue
Expand Down
17 changes: 17 additions & 0 deletions core/lib/Foswiki/Configure/Checkers/Email/SSLCaPath.pm
Expand Up @@ -36,6 +36,23 @@ sub check_current_value {
);
}

if ( $file && $path ) {
my @mods = (
{
name => 'IO::Socket::SSL',
usage =>
'Required if both ={Email}{SSLCaFile}= and ={Email}{SSLCaPath}= are set. Clear one or the other.',
minimumVersion => 1.973
}
);
Foswiki::Configure::Dependency::checkPerlModules(@mods);
foreach my $mod (@mods) {
if ( !$mod->{ok} ) {
$reporter->ERROR( $mod->{check_result} );
}
}
}

my $cfile = $Foswiki::cfg{Email}{SSLCrlFile};
Foswiki::Configure::Load::expandValue($cfile);
if ( $Foswiki::cfg{Email}{SSLCheckCRL}
Expand Down
14 changes: 9 additions & 5 deletions core/lib/Foswiki/Configure/Wizards/AutoConfigureEmail.pm
Expand Up @@ -113,6 +113,7 @@ sub _muteExec {
close $fh2;

{
# Don't try to capture STDERR on FastCGI systems. it won't work.
my $muter = Foswiki::Aux::MuteOut->new(
outFile => $outFile,
errFile => $errFile,
Expand Down Expand Up @@ -184,14 +185,17 @@ NOCERT

if ( $Foswiki::cfg{SMTP}{MAILHOST} ) {

if ( 1
|| $Foswiki::cfg{Engine} && $Foswiki::cfg{Engine} !~ m/FastCGI$/ )
{
( $ok, $out, $err ) = _muteExec( \&_autoconfigSMTP, $reporter );
if ( $Foswiki::cfg{Engine} && $Foswiki::cfg{Engine} =~ m/FastCGI$/ ) {
$reporter->WARN(
'Debug log not captured in FCGI environments. Check web server error log for debugging information'
);
$ok = _autoconfigSMTP($reporter);
}
else {
$ok = _autoconfigSMTP($reporter);
( $ok, $out, $err ) = _muteExec( \&_autoconfigSMTP, $reporter );
}
$err =~ s/AUTH\s([^\s]+)\s.*$/AUTH $1 xxxxxxxxxxxxxxxx/mg if $err;

unless ($ok) {
$reporter->WARN(
"SMTP configuration using $Foswiki::cfg{SMTP}{MAILHOST} failed. Falling back to mail program"
Expand Down
58 changes: 50 additions & 8 deletions core/lib/Foswiki/Configure/Wizards/SSLCertificates.pm
Expand Up @@ -28,6 +28,24 @@ Guess the locations of SSL Certificate files.
sub guess_locations {
my ( $this, $reporter ) = @_;

my $supportBoth = 1; # Support both CA File and CA Path.

# SMELL: Versions of IO::Socket::SSL before 1.973 will croak if both CaFile and CaPath are set.
my @mods = (
{
name => 'IO::Socket::SSL',
usage =>
'Required if both ={Email}{SSLCaFile}= and ={Email}{SSLCaPath}= are set. Clear one or the other.',
minimumVersion => 1.973
}
);
Foswiki::Configure::Dependency::checkPerlModules(@mods);
foreach my $mod (@mods) {
if ( !$mod->{ok} ) {
$supportBoth = 0;
}
}

my @CERT_FILES = (
"/etc/pki/tls/certs/ca-bundle.crt", #Fedora/RHEL
"/etc/ssl/certs/ca-certificates.crt", #Debian/Ubuntu/Gentoo etc.
Expand All @@ -53,22 +71,22 @@ sub guess_locations {
if ( $file || $path ) {
$reporter->NOTE("Guessed from LWP settings");
$guessed = 1;
_setLocations( $reporter, $file, $path );
_setLocations( $reporter, $file, $path, $supportBoth );
}
else {
( $file, $path ) = @ENV{qw/HTTPS_CA_FILE HTTPS_CA_DIR/};
if ( $file || $path ) {
$reporter->NOTE("Guessed from Crypt::SSLEay's settings");
$guessed = 1;
_setLocations( $reporter, $file, $path );
_setLocations( $reporter, $file, $path, $supportBoth );
}
else {
if ( eval('require Mozilla::CA;') ) {
$file = Mozilla::CA::SSL_ca_file();
if ($file) {
$reporter->NOTE("Obtained from Mozilla::CA");
$guessed = 1;
_setLocations( $reporter, $file, $path );
_setLocations( $reporter, $file, $path, $supportBoth );
}
else {
$reporter->WARN("Mozilla::CA is installed but has no file");
Expand All @@ -83,21 +101,19 @@ sub guess_locations {
if ( -e $file && -r $file ) {
$guessed = 1;
$reporter->NOTE("Guessed $file as the CA certificate bundle.");
_setLocations( $reporter, $file, $path );
_setLocations( $reporter, $file, $path, $supportBoth );
last;
}
}

# SMELL: I've seen some errors that suggest that only File or Path should be specified
# but IO::Socket::SSL docs clearly state both are acceptable.
#return undef if ($guessed);
return undef if ( $guessed && !$supportBoth );

# First see if the linux default path work
foreach $path (@CERT_DIRS) {
if ( -d $path && -r $path ) {
$reporter->NOTE("Guessed $path as the certificate directory.");
$guessed = 1;
_setLocations( $reporter, $file, $path );
_setLocations( $reporter, $file, $path, $supportBoth );
}
}

Expand All @@ -114,10 +130,36 @@ sub _setLocations {

# my ( $reporter, $file, $path ) = @_
#$_[0]->WARN(Foswiki::Configure::Checker::GUESSED_MESSAGE);

if (
!$_[3]
&& ( $Foswiki::cfg{Email}{SSLCaFile}
|| $Foswiki::cfg{Email}{SSLCaPath} )
)
{
$_[0]->WARN(
'Obsolete version of IO::Socket::SSL installed: ={Email}{SSLCaFile}= and ={Email}{SSLCaPath}= must not both be set.'
);
return;
}

if ( $_[1] ) {
$Foswiki::cfg{Email}{SSLCaFile} = $_[1];
$_[0]->CHANGED('{Email}{SSLCaFile}');
}

if (
!$_[3]
&& ( $Foswiki::cfg{Email}{SSLCaFile}
|| $Foswiki::cfg{Email}{SSLCaPath} )
)
{
$_[0]->WARN(
'Obsolete version of IO::Socket::SSL installed: ={Email}{SSLCaFile}= and ={Email}{SSLCaPath}= must not both be set.'
);
return;
}

if ( $_[2] ) {
$Foswiki::cfg{Email}{SSLCaPath} = $_[2];
$_[0]->CHANGED('{Email}{SSLCaPath}');
Expand Down
23 changes: 1 addition & 22 deletions core/lib/Foswiki/Engine.pm
Expand Up @@ -34,33 +34,12 @@ BEGIN {
Constructs an engine object.
The default object has three initialized keys on it: =fhOUT=, =fhERR=.
Those are filehandles used to communicate with HTTP server/environment and by
default they're set to =STDIN=, =STDOUT=, and =STDERR= correspondingly. It is
recommended to use =$engine->{fhERR}= instead of STDERR in order to get error
messages always logged correctly:
<verbatim>
print $Foswiki::engine->{fhERR} "This is the error we wanna see in the log.\n";
$SIG{__DIE__} = sub {
print $Foswiki::engine->{fhERR} @_;
exit 1;
};
</verbatim>
=cut

sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $this = {

# Standard file handles to support engines/environments where
# communication is based on custom sockets.
fhOUT => \*STDOUT,
fhERR => \*STDERR,
};
my $this = {};
return bless $this, $class;
}

Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Engine/CGI.pm
Expand Up @@ -234,7 +234,7 @@ sub prepareBody {
# as breaking uploads (though cdot believes this is because of the
# deprecated dual nature of param delivering lightweight file handles,
# and it would probably work in Foswiki. Just not tried it)
my $cgi = new CGI;
my $cgi = new CGI();
my $err = $cgi->cgi_error;
throw Foswiki::EngineException( $1, $2 )
if defined $err && $err =~ m/\s*(\d{3})\s*(.*)/;
Expand Down
7 changes: 6 additions & 1 deletion core/tools/check_extensions.pl
Expand Up @@ -3,7 +3,6 @@
use strict;
use warnings;

# cruise back up the tree until we find lib and data subdirs
use Cwd;
use File::Spec;
use File::Find;
Expand All @@ -14,6 +13,9 @@
my $extension = shift;
my %items; # Hash to cache item # & descriptions.

# Tasks that are typically left open and not documented in release notes, eg. Documentation, Translation, etc.
my @omit = (qw(Item13883 Item13884 Item13504));

my $start = `git describe --tags --abbrev=0`;
unless ($start) {
help();
Expand Down Expand Up @@ -81,6 +83,9 @@ END
my $last = '';
foreach my $item ( sort @itemlist ) {
next if $item eq $last;

#SMELL: SmartMatch is experimental. But had to give it a try. Will be changed in upcoming perl.
next if $item ~~ @omit;
$last = $item;
my $taskinfo = get_task_info($item);
print "WARNING: Wrong state: $taskinfo\n"
Expand Down

0 comments on commit bed56ea

Please sign in to comment.