Permalink
Browse files

Item14205: Fixed a bug where two consequent auto-config button clicks…

… led to a perl error.
  • Loading branch information...
vrurg committed Nov 9, 2016
1 parent 74d590a commit ed6218fd5e0d34aadc66525c941d3ade6b59a9dc
Showing with 10 additions and 4 deletions.
  1. +10 −4 core/lib/Foswiki/Configure/Wizards/AutoConfigureEmail.pm
@@ -487,6 +487,8 @@ our (
);
our $pad = ' ' x length('Net::SMTpXXX ');
+my @Net_SMTP_default_ISA;
+
# Return 0 on failure
sub _autoconfigSMTP {
my ($reporter) = @_;
@@ -505,6 +507,9 @@ sub _autoconfigSMTP {
}
}
+ # Kinda simulate state variables.
+ @Net_SMTP_default_ISA = @Net::SMTP::ISA unless @Net_SMTP_default_ISA;
+
my $trySSL = 1;
# Make sure all SSL dependencies are available. If any fail, don't try SSL.
@@ -538,7 +543,7 @@ sub _autoconfigSMTP {
# Enable IPv6 if it's available
@Net::SMTP::ISA = (
- grep( $_ !~ /^IO::Socket::I(?:NET|P)$/, @Net::SMTP::ISA ),
+ grep( $_ !~ /^IO::Socket::I(?:NET|P)$/, @Net_SMTP_default_ISA ),
'IO::Socket::IP'
);
}
@@ -623,15 +628,15 @@ sub _autoconfigSMTP {
# Configuration data for each method. Ports in priority order.
my $sockSSLisa = [
- grep( $_ !~ /^IO::Socket::I(?:NET|P)$/, @Net::SMTP::ISA ),
+ grep( $_ !~ /^IO::Socket::I(?:NET|P)$/, @Net_SMTP_default_ISA ),
'IO::Socket::SSL'
];
my %config = (
starttls => {
ports => [qw/submission(587) smtp(25)/],
method => 'Net::SMTP (STARTTLS)',
- isa => [@Net::SMTP::ISA],
+ isa => [@Net_SMTP_default_ISA],
ssl => [ SSL_version => 'TLSv1' ],
starttls => 1,
},
@@ -650,7 +655,7 @@ sub _autoconfigSMTP {
smtp => {
ports => [qw/submission(587) smtp(25)/],
method => 'Net::SMTP',
- isa => [@Net::SMTP::ISA],
+ isa => [@Net_SMTP_default_ISA],
},
);
@Net::SMTP::ISA = 'Foswiki::Configure::Wizards::AutoConfigureEmail::SSL';
@@ -778,6 +783,7 @@ sub _autoconfigSMTP {
$tlsSsl = 0
if ( $startTls = $cfg->{starttls} );
+ @Foswiki::Configure::Wizards::AutoConfigureEmail::SSL::ISA = ();
@Foswiki::Configure::Wizards::AutoConfigureEmail::SSL::ISA =
@{ $cfg->{isa} };

0 comments on commit ed6218f

Please sign in to comment.