Add smtp_auth hook (thanks to Emmanuel Dreyfus)
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 2 Apr 2011 19:19:45 +0000 (19:19 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 2 Apr 2011 19:19:45 +0000 (19:19 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@14094 7612ce4b-ef26-0410-bec9-ea0150e637f0

class/deliver/Deliver_SMTP.class.php
doc/ChangeLog

index 91b52644fe256769c3aec4cc4561e84c85c450be..ac3db6a7b687acde28f5c5795a0670f19a199f74 100644 (file)
@@ -210,7 +210,19 @@ class Deliver_SMTP extends Deliver {
         }
 
         // FIXME: check ehlo response before using authentication
         }
 
         // FIXME: check ehlo response before using authentication
-        if (( $smtp_auth_mech == 'cram-md5') or ( $smtp_auth_mech == 'digest-md5' )) {
+
+        // Try authentication by a plugin
+        $smtp_auth_args = array(
+            'auth_mech' => $smtp_auth_mech,
+            'user' => $user,
+            'pass' => $pass,
+            'host' => $host,
+            'port' => $port,
+            'stream' => $stream,
+        );
+        if (boolean_hook_function('smtp_auth', $smtp_auth_args, 1)) {
+            // authentication succeeded
+        } else if (( $smtp_auth_mech == 'cram-md5') or ( $smtp_auth_mech == 'digest-md5' )) {
             // Doing some form of non-plain auth
             if ($smtp_auth_mech == 'cram-md5') {
                 fputs($stream, "AUTH CRAM-MD5\r\n");
             // Doing some form of non-plain auth
             if ($smtp_auth_mech == 'cram-md5') {
                 fputs($stream, "AUTH CRAM-MD5\r\n");
index 23300a5bdf11b448b8b9895831a1bb4d4141473c..98241eac32cd123def38309ee190da42f4383946 100644 (file)
@@ -356,6 +356,7 @@ Version 1.5.2 - SVN
   - Forced addition of a file suffix to attachments that lack a filename
     (helps forwarded messages avoid spam filters) (Thanks to Petr
     Kletecka) (#3139004).
   - Forced addition of a file suffix to attachments that lack a filename
     (helps forwarded messages avoid spam filters) (Thanks to Petr
     Kletecka) (#3139004).
+  - Added smtp_auth hook (Thanks to Emmanuel Dreyfus).
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------