Horde\ManageSieve::_authDigestMD5 PHP Method

_authDigestMD5() protected method

Authenticates the user using the DIGEST-MD5 method.
protected _authDigestMD5 ( string $user, string $pass, string $euser )
$user string The userid to authenticate as.
$pass string The password to authenticate with.
$euser string The effective uid to authenticate as.
    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();
    }