about summary refs log tree commit
diff options
context:
space:
mode:
-rw-r--r--Changes2
-rw-r--r--lib/Net/SMTP.pm3
2 files changed, 3 insertions, 2 deletions
diff --git a/Changes b/Changes
index b1c737b..8928e1d 100644
--- a/Changes
+++ b/Changes
@@ -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);
     }