about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-06-03 09:00:16 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2014-06-03 09:00:16 +0100
commit8dedae07612e77e4a46214334e83891dd3ce388b (patch)
tree386b9ccf0ea214348272b537d3ddffbc9daaec7d
parent036e8cefc78086246412411638fd402c5d657dc2 (diff)
downloadperl-libnet-8dedae07612e77e4a46214334e83891dd3ce388b.tar.gz
Net::SMTP::auth() should use AUTH mechanism(s) supplied in Authen::SASL object if present
Patch by Ewen McNeill from CPAN RT#58002.
-rw-r--r--Changes5
-rw-r--r--Net/SMTP.pm5
2 files changed, 9 insertions, 1 deletions
diff --git a/Changes b/Changes
index e51a43b..264d3e3 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,10 @@
 libnet 1.28  -- TODO
 
+  * Change Net::SMTP::auth() so that it uses the SMTP AUTH mechanism(s)
+    specified in the Authen::SASL object if one is provided instead of a
+    username.   If a plain text username is specified then use the first
+    reported SMTP AUTH method supported, as usual.  [Ewen McNeill; resolves CPAN
+    RT#58002]
   * Add support for IPv6 and SSL to Net::SMTP and Net::POP3.  These features are
     only available if the user has
 
diff --git a/Net/SMTP.pm b/Net/SMTP.pm
index 819ce8c..52b5060 100644
--- a/Net/SMTP.pm
+++ b/Net/SMTP.pm
@@ -165,7 +165,10 @@ sub auth {
 
   if (ref($username) and UNIVERSAL::isa($username, 'Authen::SASL')) {
     $sasl = $username;
-    $sasl->mechanism($mechanisms);
+    my $requested_mechanisms = $sasl->mechanism();
+    if (! defined($requested_mechanisms) || $requested_mechanisms eq '') {
+      $sasl->mechanism($mechanisms);
+    }
   }
   else {
     die "auth(username, password)" if not length $username;