diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2014-12-09 13:45:02 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2014-12-09 13:45:02 +0000 |
commit | 56e5ec7a786f0a0b5c95f017285b8b9791de068a (patch) | |
tree | ca0a70dcc84691785eb3bd2a15e416b354837982 | |
parent | 205a35884f210a3ca8afc01a9a195b173f329466 (diff) | |
download | perl-libnet-56e5ec7a786f0a0b5c95f017285b8b9791de068a.tar.gz |
last does not work in a do {} block
There is no point in continuing with the auth() function if there are no mechanisms left to try (it would only issue an AUTH command with no arguments, which is a syntax error) so simply return instead of trying to jump out of the do {} block. Also return if we cannot get the failed mechanism from the client because in that case we have no way of changing the list of mechanisms to try. Partially fixes CPAN RT#100235.
-rw-r--r-- | Changes | 2 | ||||
-rw-r--r-- | lib/Net/SMTP.pm | 3 |
2 files changed, 3 insertions, 2 deletions
@@ -2,7 +2,7 @@ Revision history for Perl distribution libnet 3.05 Development - - TODO + - Fixed infinite loop in Net::SMTP::auth(). [CPAN RT#100235] 3.04 2014-11-29 diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm index 57f51cc..afd017a 100644 --- a/lib/Net/SMTP.pm +++ b/lib/Net/SMTP.pm @@ -193,10 +193,11 @@ sub auth { if ($client) { # $client mechanism failed, so we need to exclude this mechanism from list my $failed_mechanism = $client->mechanism; + return unless defined $failed_mechanism; $self->debug_text("Auth mechanism failed: $failed_mechanism") if $self->debug; $mechanisms =~ s/\b\Q$failed_mechanism\E\b//; - last unless $mechanisms =~ /\S/; + return unless $mechanisms =~ /\S/; $sasl->mechanism($mechanisms); } |