gssapi/names.py
def canonicalize(self, mech):
        """
        Create a canonical mechanism name (MechName) from an arbitrary internal name. The canonical
        MechName would be set as the :attr:`~gssapi.ctx.AcceptContext.peer_name` property on an
        acceptor's :class:`~gssapi.ctx.AcceptContext` if an initiator performed a successful
        authentication to the acceptor using the given mechanism, using a
        :class:`~gssapi.creds.Credential` obtained using this :class:`Name`.

        :param mech: The mechanism to canonicalize this name for
        :type mech: :class:`~gssapi.oids.OID`
        :returns: a canonical mechanism name based on this internal name.
        :rtype: :class:`MechName`
        """
        if isinstance(mech, OID):
            oid = mech._oid
        else:
            raise TypeError("Expected an OID, got " + str(type(mech)))

        minor_status = ffi.new('OM_uint32[1]')
        out_name = ffi.new('gss_name_t[1]')
        try:
            retval = C.gss_canonicalize_name(
                minor_status, self._name[0], ffi.addressof(oid), out_name
            )
            if GSS_ERROR(retval):
                raise _exception_for_status(retval, minor_status[0])
            return MechName(out_name, mech)
        except:
            C.gss_release_name(minor_status, out_name)
def canonicalize(self, mech):
        """
        Create a canonical mechanism name (MechName) from an arbitrary internal name. The canonical
        MechName would be set as the :attr:`~gssapi.ctx.AcceptContext.peer_name` property on an
        acceptor's :class:`~gssapi.ctx.AcceptContext` if an initiator performed a successful
        authentication to the acceptor using the given mechanism, using a
        :class:`~gssapi.creds.Credential` obtained using this :class:`Name`.

        :param mech: The mechanism to canonicalize this name for
        :type mech: :class:`~gssapi.oids.OID`
        :returns: a canonical mechanism name based on this internal name.
        :rtype: :class:`MechName`
        """
        if isinstance(mech, OID):
            oid = mech._oid
        else:
            raise TypeError("Expected an OID, got " + str(type(mech)))

        minor_status = ffi.new('OM_uint32[1]')
        out_name = ffi.new('gss_name_t[1]')
        try:
            retval = C.gss_canonicalize_name(
                minor_status, self._name[0], ffi.addressof(oid), out_name
            )
            if GSS_ERROR(retval):
                raise _exception_for_status(retval, minor_status[0])
            return MechName(out_name, mech)
        except:
            C.gss_release_name(minor_status, out_name)
def canonicalize ( self , mech ) : if isinstance ( mech , OID ) : oid = mech . _oid else : raise TypeError ( "Expected an OID, got " + str ( type ( mech ) ) ) minor_status = ffi . new ( 'OM_uint32[1]' ) out_name = ffi . new ( 'gss_name_t[1]' ) try : retval = C . gss_canonicalize_name ( minor_status , self . _name [ 0 ] , ffi . addressof ( oid ) , out_name ) if GSS_ERROR ( retval ) : raise _exception_for_status ( retval , minor_status [ 0 ] ) return MechName ( out_name , mech ) except : C . gss_release_name ( minor_status , out_name )
Create a canonical mechanism name (MechName) from an arbitrary internal name. The canonical
        MechName would be set as the :attr:`~gssapi.ctx.AcceptContext.peer_name` property on an
        acceptor's :class:`~gssapi.ctx.AcceptContext` if an initiator performed a successful
        authentication to the acceptor using the given mechanism, using a
        :class:`~gssapi.creds.Credential` obtained using this :class:`Name`.

        :param mech: The mechanism to canonicalize this name for
        :type mech: :class:`~gssapi.oids.OID`
        :returns: a canonical mechanism name based on this internal name.
        :rtype: :class:`MechName`
Create a canonical mechanism name ( MechName ) from an arbitrary internal name . The canonical MechName would be set as the : attr : ~gssapi . ctx . AcceptContext . peer_name property on an acceptor s : class : ~gssapi . ctx . AcceptContext if an initiator performed a successful authentication to the acceptor using the given mechanism using a : class : ~gssapi . creds . Credential obtained using this : class : Name .