-
Notifications
You must be signed in to change notification settings - Fork 49
the code for accepting delegated credentials is incorrect #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Recording conversations for posterity: RFC 2744 says:
RFC 2743 says (in Inquire_context):
And says for init_sec_context (also applying to accept_sec_context):
So it looks like we should check for |
So the question is: does "undefined" mean "up to the implementation" or "in an invalid state" here?
meaning that it's fine to just check NULL. My concern is that if we add more complicated logic than "is it NULL or not" and miss a valid pointer, we'll have a memory leak, since
But if we wrap an invalid pointer, then we'll try to release() an invalid pointer. (this phrasing seems to support the case that delegated_creds will always be either NULL or valid). |
(My opinion that I mentioned in our conversation is that it means "up to the implementation" since if it were "invalid" it would be stated as such, but I don't have anything to back that up.) |
If GSS_S_COMPLETE is returned then delegated_creds is either NULL (when deleg_state is False) or it is a valid credential (and deleg_state is True). This is a requirement by 2744: "if deleg_flag is false, gss_accept_context() will set this parameter to GSS_C_NO_CREDENTIAL. GSS_C_NO_CREDENTIAL == NULL |
Yes, I know that. NULL is shorter to type. 2743 potentially seems to imply (under one interpretation of "undefined") that there's cases where the value of deleg_flag might not be "valid" |
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
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
After discussion I believe this has been resolved. If there's more to say we should reopen (and retarget). |
Both the low level and the high level API unconditionally try at any step of the context extablishment (on the acceptor side) to return delegated credentials and create the appropriate classes.
Delegated credentials are returned only if the context establishment return GSS_S_COMPLETE and are undefined in any other step.
In the high level API care need to be taken so that if the lower level returns None the delegated_creds should be set straight to None as well, as calling Credentials(None) will istead try to fetch the default credentials for the process, and that is an error.
The text was updated successfully, but these errors were encountered: