about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-10-10 23:42:22 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2014-10-10 23:42:22 +0100
commit2c160b441ccc609bf4397ad7dd783c68b8cac4c2 (patch)
treefe98d58afc79f4b77f634210b85c95cb74185c05
parentde461570042fa59a336e7eb210ffd7ca87a26dbb (diff)
downloadperl-libnet-2c160b441ccc609bf4397ad7dd783c68b8cac4c2.tar.gz
Fix $smtp->auth($sasl)
Try the AUTH mechanism (if present) in the Authen::SASL object before
falling back on other mechanisms.

Resolves CPAN RT#99415.
-rw-r--r--Changes4
-rw-r--r--lib/Net/SMTP.pm2
2 files changed, 4 insertions, 2 deletions
diff --git a/Changes b/Changes
index 12f229e..82b9b4e 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 libnet 3.02  -- TODO
 
-  * TODO
+  * Fix $smtp->auth($sasl) to try the AUTH mechanism (if present) in the
+    Authen::SASL object before falling back on other mechanisms. [Resolves
+    CPAN RT#99415]
 
 libnet 3.01  -- Thu Oct 09 2014
 
diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm
index df90227..feeb1da 100644
--- a/lib/Net/SMTP.pm
+++ b/lib/Net/SMTP.pm
@@ -193,8 +193,8 @@ sub auth {
         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