Allow certificate and credential callbacks to decline to act - #4879
Merged
Conversation
Contributor
pks-t
reviewed
Nov 7, 2018
Custom transports may want to ask libgit2 to invoke a configured credential or certificate callback; however they likely do not know if a callback was actually configured. Return a sentinal value (GIT_PASSTHROUGH) if there is no callback configured instead of crashing.
ethomson
force-pushed
the
ethomson/defer_cert_cred_cb
branch
from
November 15, 2018 09:19
f25053c to
dab7cbd
Compare
Member
Author
Contributor
|
I don't really mind. I hope you're going to fix it right here, but in any case I think it's easier to do so after your cleanup. #4042 is about ignoring a callback's presence in case |
pks-t
reviewed
Nov 21, 2018
Allow credential and certificate checking callbacks to return GIT_PASSTHROUGH, indicating that they do not want to act. Introduce this to support in both the http and ssh callbacks. Additionally, enable the same mechanism for certificate validation. This is most useful to disambiguate any meaning in the publicly exposed credential and certificate functions (`git_transport_smart_credentials` and `git_transport_smart_certificate_check`) but it may be more generally useful for callers to be able to defer back to libgit2.
ethomson
force-pushed
the
ethomson/defer_cert_cred_cb
branch
from
November 21, 2018 23:06
dab7cbd to
a2e6e0e
Compare
Member
|
Thanks Ed! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Custom transports may want to ask libgit2 to invoke a configured credential or certificate callback; however they likely do not know if a callback was actually configured. Return a sentinal value (greater than zero) if there is no callback configured instead of crashing.
With this, we want to define what
> 0means for these callbacks, because they themselves might return it. Credential callbacks are already defined to return> 0to defer these checks, but they were only inconsistently implemented (winhttp supported this, http and ssh transports did not). Add this support consistently to all transports for both credential callbacks and certificate checking.