{"action":"created","issue":{"url":"https://api.github.com/repos/libgit2/libgit2/issues/3440","labels_url":"https://api.github.com/repos/libgit2/libgit2/issues/3440/labels{/name}","comments_url":"https://api.github.com/repos/libgit2/libgit2/issues/3440/comments","events_url":"https://api.github.com/repos/libgit2/libgit2/issues/3440/events","html_url":"https://github.com/libgit2/libgit2/issues/3440","id":108497312,"number":3440,"title":"The certificate callback should support pass-through","user":{"login":"carlosmn","id":335443,"avatar_url":"https://avatars.githubusercontent.com/u/335443?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosmn","html_url":"https://github.com/carlosmn","followers_url":"https://api.github.com/users/carlosmn/followers","following_url":"https://api.github.com/users/carlosmn/following{/other_user}","gists_url":"https://api.github.com/users/carlosmn/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosmn/subscriptions","organizations_url":"https://api.github.com/users/carlosmn/orgs","repos_url":"https://api.github.com/users/carlosmn/repos","events_url":"https://api.github.com/users/carlosmn/events{/privacy}","received_events_url":"https://api.github.com/users/carlosmn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/libgit2/libgit2/labels/easy%20fix","name":"easy fix","color":"FF33FF"},{"url":"https://api.github.com/repos/libgit2/libgit2/labels/up%20for%20grabs","name":"up for grabs","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-26T21:35:41Z","updated_at":"2015-10-29T10:44:05Z","closed_at":null,"body":"This callback wants a response from the callback; if we have none to give (we're wrapping the callbacks in some language, so we always end up setting the fields) we should be able to tell libgit2 not to take our answer into account.\r\n\r\nReturning `GIT_PASSTHROUGH` should make the callers of the callback behave as though it was not there, like they do with the credentials callback."},"comment":{"url":"https://api.github.com/repos/libgit2/libgit2/issues/comments/152143898","html_url":"https://github.com/libgit2/libgit2/issues/3440#issuecomment-152143898","issue_url":"https://api.github.com/repos/libgit2/libgit2/issues/3440","id":152143898,"user":{"login":"carlosmn","id":335443,"avatar_url":"https://avatars.githubusercontent.com/u/335443?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosmn","html_url":"https://github.com/carlosmn","followers_url":"https://api.github.com/users/carlosmn/followers","following_url":"https://api.github.com/users/carlosmn/following{/other_user}","gists_url":"https://api.github.com/users/carlosmn/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosmn/subscriptions","organizations_url":"https://api.github.com/users/carlosmn/orgs","repos_url":"https://api.github.com/users/carlosmn/repos","events_url":"https://api.github.com/users/carlosmn/events{/privacy}","received_events_url":"https://api.github.com/users/carlosmn/received_events","type":"User","site_admin":false},"created_at":"2015-10-29T10:44:05Z","updated_at":"2015-10-29T10:44:05Z","body":"The credentials callback is a field in the `git_remote_callbacks` structure, passed in their respective options to fetch and push. The transports are then passed in the callbacks via a setter function. For SSH, the call to it is done in [line 426](https://github.com/libgit2/libgit2/blob/a8d0b4de92b83745308b2d9af0f62828bfb550a1/src/transports/ssh.c#L426). The HTTP backends do something similar.\r\n\r\nThe certificate callback is another one of the remote callback fields, called by the transports (or their underlying IO streams). Each of the connection methods calls this certificate when they receive the server's certificate (or hostkey for SSH). E.g. in (line 558)[https://github.com/libgit2/libgit2/blob/a8d0b4de92b83745308b2d9af0f62828bfb550a1/src/transports/ssh.c#L558]. It currently returns an error for any error value returned by the callback. It should instead check if it's `GIT_EPASSTHROUGH` and then do what it would do if the callback weren't set.\r\n\r\nThe OpenSSL, SecureTransport and WinHTTP code also calls the certificate callback, so those need to be converted as well."}}