diff options
| author | lhchavez <[email protected]> | 2020-12-06 11:55:04 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-06 11:55:04 -0800 |
| commit | abf02bc7d79dfb7b0bbcd404ebecb202cff2a18e (patch) | |
| tree | ec93caf1ed9238b91e7ec6a1c1e470441860f6fc /wrapper.c | |
| parent | 54afccfa0f5a5574525cbba3b4568cbda252a3df (diff) | |
Add `NewCredentialSSHKeyFromSigner` (#706)
This change adds `NewCredentialSSHKeyFromSigner`, which allows idiomatic
use of SSH keys from Go. This also lets us spin off an SSH server in the
tests.
Diffstat (limited to 'wrapper.c')
| -rw-r--r-- | wrapper.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -437,6 +437,29 @@ git_credential_t _go_git_credential_credtype(git_credential *cred) return cred->credtype; } +static int credential_ssh_sign_callback( + LIBSSH2_SESSION *session, + unsigned char **sig, size_t *sig_len, + const unsigned char *data, size_t data_len, + void **abstract) +{ + char *error_message = NULL; + const int ret = credentialSSHSignCallback( + &error_message, + sig, + sig_len, + (unsigned char *)data, + data_len, + (void *)*(uintptr_t *)abstract); + return set_callback_error(error_message, ret); +} + +void _go_git_populate_credential_ssh_custom(git_credential_ssh_custom *cred) +{ + cred->parent.free = (void (*)(git_credential *))credentialSSHCustomFree; + cred->sign_callback = credential_ssh_sign_callback; +} + int _go_git_odb_write_pack(git_odb_writepack **out, git_odb *db, void *progress_payload) { return git_odb_write_pack(out, db, transfer_progress_callback, progress_payload); |
