about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-06-03 13:11:03 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2014-06-03 13:11:03 +0100
commite085102cfdeaa08794a0cd9bb2c6672edfb29336 (patch)
tree01b7799d4bb912b803748d3bda2a109a2b214829
parentf1ca43cf5ff96f057b9c902bacedf0b0099790c2 (diff)
downloadperl-libnet-e085102cfdeaa08794a0cd9bb2c6672edfb29336.tar.gz
Exit loop over AUTH mechanisms when there are no more left to avoid infinite loop
-rw-r--r--Net/SMTP.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/Net/SMTP.pm b/Net/SMTP.pm
index 72ad541..a889402 100644
--- a/Net/SMTP.pm
+++ b/Net/SMTP.pm
@@ -189,11 +189,12 @@ sub auth {
     if ($client) {
       # $client mechanism failed, so we need to exclude this mechanism from list
       my $failed_mechanism = $client->mechanism;
-      $self->debug_text ("Auth mechanism failed: $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/;
     }
-    $sasl->mechanism ($mechanisms);
+    $sasl->mechanism($mechanisms);
     
     # We should probably allow the user to pass the host, but I don't
     # currently know and SASL mechanisms that are used by smtp that need it