[RCD] [PATCH] Plugin hook for SMTP authentication

Emmanuel Dreyfus manu at netbsd.org
Thu Jun 4 17:28:32 CEST 2015


On Thu, Jun 04, 2015 at 08:58:10AM +0000, Emmanuel Dreyfus wrote:
> 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?

Replying to myself for someone else's future reference:

Indeed smtp_auth_callbacks does what I need without my patch. In
my plugin's init() I need to do:
    $this->add_hook('smtp_connect', array($this, 'smtp_add_auth'))

Then in the same plugin
  function smtp_add_auth($args) {
        $args['smtp_auth_callbacks'][] = array(
                'name'          => 'SAML',
                'function'      => array($this, 'auth_saml'), 
        );
        return $args;
  }

And auth_saml($uid, $pwd, $authz, $object) can talk to the SMTP 
server, giving expected errors:
    if (PEAR::isError($error = $object->command("AUTH SAML", 334)))
      return $error

The value 334 may be replace by an array of values.




-- 
Emmanuel Dreyfus
manu at netbsd.org


More information about the dev mailing list