From 85c563a27c675523e8c397d4ae8f38f59edc0118 Mon Sep 17 00:00:00 2001 From: Solly Ross <sross@redhat.com> Date: Wed, 21 Mar 2018 11:58:54 -0400 Subject: [PATCH] Handle GSS_C_NO_OID_SET when creating sets 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 --- gssapi/raw/cython_converters.pyx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gssapi/raw/cython_converters.pyx b/gssapi/raw/cython_converters.pyx index fa5d15b7..e1e76954 100644 --- a/gssapi/raw/cython_converters.pyx +++ b/gssapi/raw/cython_converters.pyx @@ -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):