protected function _authDigestMD5($user, $pass, $euser)
{
$challenge = $this->_doCmd('AUTHENTICATE "DIGEST-MD5"', true);
$challenge = base64_decode(trim($challenge));
$digest = Auth_SASL::factory('digestmd5');
// @todo Really 'localhost'?
$response = $digest->getResponse($user, $pass, $challenge, 'localhost', 'sieve', $euser);
if (is_a($response, 'PEAR_Error')) {
throw new Exception($response);
}
$this->_sendStringResponse(base64_encode($response));
$this->_doCmd('', true);
if (\Horde_String::upper(substr($result, 0, 2)) == 'OK') {
return;
}
/* We don't use the protocol's third step because SIEVE doesn't allow
* subsequent authentication, so we just silently ignore it. */
$this->_sendStringResponse('');
$this->_doCmd();
}