protected function authCRAMMD5($uid, $pwd, $authz = '')
    {
        if (PEAR::isError($error = $this->put('AUTH', 'CRAM-MD5'))) {
            return $error;
        }
        /* 334: Continue authentication request */
        if (PEAR::isError($error = $this->parseResponse(334))) {
            /* 503: Error: already authenticated */
            if ($this->code === 503) {
                return true;
            }
            return $error;
        }

        $auth_sasl = new Auth_SASL;
        $challenge = base64_decode($this->arguments[0]);
        $cram      = $auth_sasl->factory('cram-md5');
        $auth_str  = base64_encode($cram->getResponse($uid, $pwd, $challenge));

        if (PEAR::isError($error = $this->put($auth_str))) {
            return $error;
        }

        /* 235: Authentication successful */
        if (PEAR::isError($error = $this->parseResponse(235))) {
            return $error;
        }
    }
protected function authCRAMMD5($uid, $pwd, $authz = '')
    {
        if (PEAR::isError($error = $this->put('AUTH', 'CRAM-MD5'))) {
            return $error;
        }
        /* 334: Continue authentication request */
        if (PEAR::isError($error = $this->parseResponse(334))) {
            /* 503: Error: already authenticated */
            if ($this->code === 503) {
                return true;
            }
            return $error;
        }

        $auth_sasl = new Auth_SASL;
        $challenge = base64_decode($this->arguments[0]);
        $cram      = $auth_sasl->factory('cram-md5');
        $auth_str  = base64_encode($cram->getResponse($uid, $pwd, $challenge));

        if (PEAR::isError($error = $this->put($auth_str))) {
            return $error;
        }

        /* 235: Authentication successful */
        if (PEAR::isError($error = $this->parseResponse(235))) {
            return $error;
        }
    }
protected function authCRAMMD5 ( $ uid , $ pwd , $ authz = '' ) { if ( PEAR :: isError ( $ error = $ this -> put ( 'AUTH' , 'CRAM-MD5' ) ) ) { return $ error ; } /* 334: Continue authentication request */ if ( PEAR :: isError ( $ error = $ this -> parseResponse ( 334 ) ) ) { /* 503: Error: already authenticated */ if ( $ this -> code === 503 ) { return true ; } return $ error ; } $ auth_sasl = new Auth_SASL ; $ challenge = base64_decode ( $ this -> arguments [ 0 ] ) ; $ cram = $ auth_sasl -> factory ( 'cram-md5' ) ; $ auth_str = base64_encode ( $ cram -> getResponse ( $ uid , $ pwd , $ challenge ) ) ; if ( PEAR :: isError ( $ error = $ this -> put ( $ auth_str ) ) ) { return $ error ; } /* 235: Authentication successful */ if ( PEAR :: isError ( $ error = $ this -> parseResponse ( 235 ) ) ) { return $ error ; } }
Authenticates the user using the CRAM-MD5 method.

@param string $uid   The userid to authenticate as.
@param string $pwd   The password to authenticate with.
@param string $authz The optional authorization proxy identifier.

@return mixed Returns a PEAR_Error with an error message on any
kind of failure, or true on success.
@since 1.1.0
Authenticates the user using the CRAM - MD5 method .