@@ -6,6 +6,7 @@ import six
66
77from gssapi.raw.cython_types cimport *
88from gssapi.raw.cython_converters cimport c_create_oid_set
9+ from gssapi.raw.names cimport Name
910from gssapi.raw.oids cimport OID
1011
1112from gssapi.raw.types import MechType
@@ -26,6 +27,10 @@ cdef extern from "gssapi.h":
2627 const gss_OID mech_type,
2728 gss_OID_set * name_types)
2829
30+ OM_uint32 gss_inquire_mechs_for_name(OM_uint32 * minor_status,
31+ const gss_name_t input_name,
32+ gss_OID_set * mech_types)
33+
2934
3035def indicate_mechs ():
3136 """
@@ -76,6 +81,35 @@ def inquire_names_for_mech(OID mech_type not None):
7681 raise GSSError(maj_stat, min_stat)
7782
7883
84+ def inquire_mechs_for_name (Name name not None ):
85+ """ List the mechanisms which can process a name.
86+
87+ This method lists the mechanisms which may be able to
88+ process the given name.
89+
90+ Args:
91+ name (Name): the name in question
92+
93+ Returns:
94+ list: the mechanism OIDs able to process the given name
95+
96+ Raises:
97+ GSSError
98+ """
99+
100+ cdef gss_OID_set mech_types
101+
102+ cdef OM_uint32 maj_stat, min_stat
103+
104+ maj_stat = gss_inquire_mechs_for_name(& min_stat, name.raw_name,
105+ & mech_types)
106+
107+ if maj_stat == GSS_S_COMPLETE:
108+ return c_create_oid_set(mech_types)
109+ else :
110+ raise GSSError(maj_stat, min_stat)
111+
112+
79113def _display_status (unsigned int error_code , bint is_major_code ,
80114 OID mech_type = None , unsigned int message_context = 0 ):
81115 """
0 commit comments