| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 44dcf22 commit c439330
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ import six | |||
| 6 | 6 | ||
| 7 | 7 | from gssapi.raw.cython_types cimport * | |
| 8 | 8 | from gssapi.raw.cython_converters cimport c_create_oid_set | |
| 9 | + from gssapi.raw.names cimport Name | ||
| 9 | 10 | from gssapi.raw.oids cimport OID | |
| 10 | 11 | ||
| 11 | 12 | from gssapi.raw.types import MechType | |
@@ -26,6 +27,10 @@ cdef extern from "gssapi.h": | |||
| 26 | 27 | const gss_OID mech_type, | |
| 27 | 28 | gss_OID_set *name_types) | |
| 28 | 29 | ||
| 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 | + | ||
| 29 | 34 | ||
| 30 | 35 | def indicate_mechs(): | |
| 31 | 36 | """ | |
@@ -76,6 +81,35 @@ def inquire_names_for_mech(OID mech_type not None): | |||
| 76 | 81 | raise GSSError(maj_stat, min_stat) | |
| 77 | 82 | ||
| 78 | 83 | ||
| 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 | + | ||
| 79 | 113 | def _display_status(unsigned int error_code, bint is_major_code, | |
| 80 | 114 | OID mech_type=None, unsigned int message_context=0): | |
| 81 | 115 | """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -371,6 +371,15 @@ def test_inquire_names_for_mech(self): | |||
| 371 | 371 | res.shouldnt_be_none() | |
| 372 | 372 | res.should_include(gb.NameType.kerberos_principal) | |
| 373 | 373 | ||
| 374 | + def test_inquire_mechs_for_name(self): | ||
| 375 | + name = gb.import_name(self.USER_PRINC, | ||
| 376 | + gb.NameType.kerberos_principal) | ||
| 377 | + | ||
| 378 | + res = gb.inquire_mechs_for_name(name) | ||
| 379 | + | ||
| 380 | + res.shouldnt_be_none() | ||
| 381 | + res.should_include(gb.MechType.kerberos) | ||
| 382 | + | ||
| 374 | 383 | ||
| 375 | 384 | class TestIntEnumFlagSet(unittest.TestCase): | |
| 376 | 385 | def test_create_from_int(self): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments