Hello

Attached is a patch that adds a plugin hook for SMTP authentication. 
I use it to setup a custom SASL authentication.

I suspect I have already submitted it some time ago and that it
is superseeded by the smtp_auth_callbacks feature that is just 
below. Is there any documentation or example on how to use the
later?

-- 
Emmanuel Dreyfus
m...@netbsd.org
--- program/lib/Roundcube/rcube_smtp.php.orig
+++ program/lib/Roundcube/rcube_smtp.php
@@ -114,8 +114,20 @@
             $this->conn->setDebug(true, array($this, 'debug_handler'));
             $this->anonymize_log = 0;
         }
 
+        // plugin hook to add SASL mechanisms
+        $result = $rcube->plugins->exec_hook('smtp_add_auth', array(
+            'conn' => $this->conn,
+        ));
+
+        if (is_a($result, 'PEAR_Error')) {
+            $this->response[] = "Authentication setup failed: 
".$result->getMessage();
+            $this->error = array('label' => 'smtpconnerror', 'vars' => 
array('code' => $this->conn->_code));
+            $this->conn = null;
+            return false;
+        }
+
         // register authentication methods
         if (!empty($CONFIG['smtp_auth_callbacks']) && 
method_exists($this->conn, 'setAuthMethod')) {
             foreach ($CONFIG['smtp_auth_callbacks'] as $callback) {
                 $this->conn->setAuthMethod($callback['name'], 
$callback['function'],
_______________________________________________
Roundcube Development discussion mailing list
dev@lists.roundcube.net
http://lists.roundcube.net/mailman/listinfo/dev

Reply via email to