Skip to content

Commit 0b82946

Browse files
frozencemeteryDirectXMan12
authored andcommitted
Allow input_cred to be None in add_cred_impersonate_name()
Closes #19
1 parent dbe14d8 commit 0b82946

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gssapi/raw/ext_s4u.pyx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def acquire_cred_impersonate_name(Creds impersonator_cred not None,
108108
raise GSSError(maj_stat, min_stat)
109109

110110

111-
def add_cred_impersonate_name(Creds input_cred not None,
111+
def add_cred_impersonate_name(Creds input_cred,
112112
Creds impersonator_cred not None,
113113
Name name not None, OID mech not None,
114114
cred_usage='initiate', initiator_ttl=None,
@@ -159,6 +159,12 @@ def add_cred_impersonate_name(Creds input_cred not None,
159159
else:
160160
usage = GSS_C_BOTH
161161

162+
cdef gss_cred_id_t raw_input_cred
163+
if input_cred is not None:
164+
raw_input_cred = input_cred.raw_creds
165+
else:
166+
raw_input_cred = GSS_C_NO_CREDENTIAL
167+
162168
cdef gss_cred_id_t creds
163169
cdef gss_OID_set actual_mechs
164170
cdef OM_uint32 actual_initiator_ttl
@@ -167,8 +173,7 @@ def add_cred_impersonate_name(Creds input_cred not None,
167173
cdef OM_uint32 maj_stat, min_stat
168174

169175
with nogil:
170-
maj_stat = gss_add_cred_impersonate_name(&min_stat,
171-
input_cred.raw_creds,
176+
maj_stat = gss_add_cred_impersonate_name(&min_stat, raw_input_cred,
172177
impersonator_cred.raw_creds,
173178
name.raw_name, &mech.raw_oid,
174179
usage, input_initiator_ttl,

0 commit comments

Comments
 (0)