Skip to content

Commit

Permalink
Handle GSS_C_NO_OID_SET when creating sets
Browse files Browse the repository at this point in the history
Some methods can return GSS_C_NO_OID_SET on success, so we should handle
that in our set converter by returning the empty set.

Fixes #148
  • Loading branch information
DirectXMan12 authored and frozencemetery committed Mar 26, 2018
1 parent 2a2b47b commit 85c563a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gssapi/raw/cython_converters.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ cdef gss_OID_set c_get_mech_oid_set(object mechs):
cdef object c_create_oid_set(gss_OID_set mech_set, bint free=True):
"""Convert a GSS OID set struct to a set of OIDs"""

if mech_set == GSS_C_NO_OID_SET:
# return the empty set if the we get passed the C equivalent
# (it could be argued that the C equivalent is closer to None,
# but returning None would make the API harder to work with,
# without much value)
return set()

py_set = set()
cdef i
for i in range(mech_set.count):
Expand Down

0 comments on commit 85c563a

Please sign in to comment.