protected function authGSSAPI($uid, $pwd, $authz = '')
    {
        if (PEAR::isError($error = $this->put('AUTH', 'GSSAPI'))) {
            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;
        }

        if (!$this->gssapi_principal) {
            return PEAR::raiseError('No Kerberos service principal set', 2);
        }

        if (!empty($this->gssapi_cname)) {
            putenv('KRB5CCNAME=' . $this->gssapi_cname);
        }

        try {
            $ccache = new KRB5CCache();
            if (!empty($this->gssapi_cname)) {
                $ccache->open($this->gssapi_cname);
            }
            
            $gssapicontext = new GSSAPIContext();
            $gssapicontext->acquireCredentials($ccache);

            $token   = '';
            $success = $gssapicontext->initSecContext($this->gssapi_principal, null, null, null, $token);
            $token   = base64_encode($token);
        }
        catch (Exception $e) {
            return PEAR::raiseError('GSSAPI authentication failed: ' . $e->getMessage());
        }

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

        /* 334: Continue authentication request */
        if (PEAR::isError($error = $this->parseResponse(334))) {
            return $error;
        }

        $response = $this->arguments[0];

        try {
            $challenge = base64_decode($response);
            $gssapicontext->unwrap($challenge, $challenge);
            $gssapicontext->wrap($challenge, $challenge, true);
        }
        catch (Exception $e) {
            return PEAR::raiseError('GSSAPI authentication failed: ' . $e->getMessage());
        }

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

        /* 235: Authentication successful */
        if (PEAR::isError($error = $this->parseResponse(235))) {
            return $error;
        }

        return true;
    }
protected function authGSSAPI($uid, $pwd, $authz = '')
    {
        if (PEAR::isError($error = $this->put('AUTH', 'GSSAPI'))) {
            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;
        }

        if (!$this->gssapi_principal) {
            return PEAR::raiseError('No Kerberos service principal set', 2);
        }

        if (!empty($this->gssapi_cname)) {
            putenv('KRB5CCNAME=' . $this->gssapi_cname);
        }

        try {
            $ccache = new KRB5CCache();
            if (!empty($this->gssapi_cname)) {
                $ccache->open($this->gssapi_cname);
            }
            
            $gssapicontext = new GSSAPIContext();
            $gssapicontext->acquireCredentials($ccache);

            $token   = '';
            $success = $gssapicontext->initSecContext($this->gssapi_principal, null, null, null, $token);
            $token   = base64_encode($token);
        }
        catch (Exception $e) {
            return PEAR::raiseError('GSSAPI authentication failed: ' . $e->getMessage());
        }

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

        /* 334: Continue authentication request */
        if (PEAR::isError($error = $this->parseResponse(334))) {
            return $error;
        }

        $response = $this->arguments[0];

        try {
            $challenge = base64_decode($response);
            $gssapicontext->unwrap($challenge, $challenge);
            $gssapicontext->wrap($challenge, $challenge, true);
        }
        catch (Exception $e) {
            return PEAR::raiseError('GSSAPI authentication failed: ' . $e->getMessage());
        }

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

        /* 235: Authentication successful */
        if (PEAR::isError($error = $this->parseResponse(235))) {
            return $error;
        }

        return true;
    }
protected function authGSSAPI ( $ uid , $ pwd , $ authz = '' ) { if ( PEAR :: isError ( $ error = $ this -> put ( 'AUTH' , 'GSSAPI' ) ) ) { 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 ; } if ( ! $ this -> gssapi_principal ) { return PEAR :: raiseError ( 'No Kerberos service principal set' , 2 ) ; } if ( ! empty ( $ this -> gssapi_cname ) ) { putenv ( 'KRB5CCNAME=' . $ this -> gssapi_cname ) ; } try { $ ccache = new KRB5CCache ( ) ; if ( ! empty ( $ this -> gssapi_cname ) ) { $ ccache -> open ( $ this -> gssapi_cname ) ; } $ gssapicontext = new GSSAPIContext ( ) ; $ gssapicontext -> acquireCredentials ( $ ccache ) ; $ token = '' ; $ success = $ gssapicontext -> initSecContext ( $ this -> gssapi_principal , null , null , null , $ token ) ; $ token = base64_encode ( $ token ) ; } catch ( Exception $ e ) { return PEAR :: raiseError ( 'GSSAPI authentication failed: ' . $ e -> getMessage ( ) ) ; } if ( PEAR :: isError ( $ error = $ this -> put ( $ token ) ) ) { return $ error ; } /* 334: Continue authentication request */ if ( PEAR :: isError ( $ error = $ this -> parseResponse ( 334 ) ) ) { return $ error ; } $ response = $ this -> arguments [ 0 ] ; try { $ challenge = base64_decode ( $ response ) ; $ gssapicontext -> unwrap ( $ challenge , $ challenge ) ; $ gssapicontext -> wrap ( $ challenge , $ challenge , true ) ; } catch ( Exception $ e ) { return PEAR :: raiseError ( 'GSSAPI authentication failed: ' . $ e -> getMessage ( ) ) ; } if ( PEAR :: isError ( $ error = $ this -> put ( base64_encode ( $ challenge ) ) ) ) { return $ error ; } /* 235: Authentication successful */ if ( PEAR :: isError ( $ error = $ this -> parseResponse ( 235 ) ) ) { return $ error ; } return true ; }
Authenticates the user using the GSSAPI method.

PHP krb5 extension is required,
service principal and credentials cache must be set.

@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.
Authenticates the user using the GSSAPI method .