gssapi/names.py
def export(self):
        """
        Returns a representation of the Mechanism Name which is suitable for direct string
        comparison against other exported Mechanism Names. Its form is defined in the GSSAPI
        specification (RFC 2743). It can also be re-imported by constructing a :class:`Name` with
        the `name_type` param set to :const:`gssapi.C_NT_EXPORT_NAME`.

        :returns: an exported bytestring representation of this mechanism name
        :rtype: bytes
        """
        minor_status = ffi.new('OM_uint32[1]')
        output_buffer = ffi.new('gss_buffer_desc[1]')
        retval = C.gss_export_name(
            minor_status,
            self._name[0],
            output_buffer
        )
        try:
            if GSS_ERROR(retval):
                if minor_status[0] and self._mech_type:
                    raise _exception_for_status(retval, minor_status[0], self._mech_type)
                else:
                    raise _exception_for_status(retval, minor_status[0])

            return _buf_to_str(output_buffer[0])
        finally:
            if output_buffer[0].length != 0:
                C.gss_release_buffer(minor_status, output_buffer)
def export(self):
        """
        Returns a representation of the Mechanism Name which is suitable for direct string
        comparison against other exported Mechanism Names. Its form is defined in the GSSAPI
        specification (RFC 2743). It can also be re-imported by constructing a :class:`Name` with
        the `name_type` param set to :const:`gssapi.C_NT_EXPORT_NAME`.

        :returns: an exported bytestring representation of this mechanism name
        :rtype: bytes
        """
        minor_status = ffi.new('OM_uint32[1]')
        output_buffer = ffi.new('gss_buffer_desc[1]')
        retval = C.gss_export_name(
            minor_status,
            self._name[0],
            output_buffer
        )
        try:
            if GSS_ERROR(retval):
                if minor_status[0] and self._mech_type:
                    raise _exception_for_status(retval, minor_status[0], self._mech_type)
                else:
                    raise _exception_for_status(retval, minor_status[0])

            return _buf_to_str(output_buffer[0])
        finally:
            if output_buffer[0].length != 0:
                C.gss_release_buffer(minor_status, output_buffer)
Returns a representation of the Mechanism Name which is suitable for direct string
        comparison against other exported Mechanism Names. Its form is defined in the GSSAPI
        specification (RFC 2743). It can also be re-imported by constructing a :class:`Name` with
        the `name_type` param set to :const:`gssapi.C_NT_EXPORT_NAME`.

        :returns: an exported bytestring representation of this mechanism name
        :rtype: bytes