Skip to content

Commit b8c76a0

Browse files
committed
Ensure that delegated_creds is non-null when set
Previously, in the high-level API, we would unconditionally set wrap the return value of delegated_creds, which could result in delegated_creds being set to the default credentials when no delegated creds were returned (since the call would be `Credentials(None)`). This changes the logic so that delegated_creds stays set as `None` unless delegated_creds are actually returned. Partial solution for #96
1 parent 6175588 commit b8c76a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gssapi/sec_contexts.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,10 @@ def _acceptor_step(self, token):
511511
res = rsec_contexts.accept_sec_context(token, self._creds,
512512
self, self._channel_bindings)
513513

514-
self.delegated_creds = Credentials(res.delegated_creds)
514+
if res.delegated_creds is not None:
515+
self.delegated_creds = Credentials(res.delegated_creds)
516+
else:
517+
self.delegated_creds = None
515518

516519
self._complete = not res.more_steps
517520

0 commit comments

Comments
 (0)