diff options
author | Jacques Germishuys <jacquesg@striata.com> | 2014-04-17 23:03:44 +0200 |
---|---|---|
committer | Jacques Germishuys <jacquesg@striata.com> | 2014-04-18 17:58:25 +0200 |
commit | 478408c01006f39ab916675bc84b8a7340bae086 (patch) | |
tree | 48bc3acd3a69ad8b4144d31b7c8ea1efd5472e5a /include/git2/transport.h | |
parent | 3c69bebc1c18444e9358c33f56c7cfefea4d1a8f (diff) | |
download | libgit2-478408c01006f39ab916675bc84b8a7340bae086.tar.gz |
Introduce git_cred_ssh_interactive_new()
This allows for keyboard-interactive based SSH authentication
Diffstat (limited to 'include/git2/transport.h')
-rw-r--r-- | include/git2/transport.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/git2/transport.h b/include/git2/transport.h index 1f4d03eea..eba08cd27 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -41,6 +41,9 @@ typedef enum { /* git_cred_default */ GIT_CREDTYPE_DEFAULT = (1u << 3), + + /* git_cred_ssh_interactive */ + GIT_CREDTYPE_SSH_INTERACTIVE = (1u << 4), } git_credtype_t; /* The base structure for all credential types */ @@ -60,8 +63,10 @@ typedef struct { #ifdef GIT_SSH typedef LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*git_cred_sign_callback)); +typedef LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC((*git_cred_ssh_interactive_callback)); #else typedef int (*git_cred_sign_callback)(void *, ...); +typedef int (*git_cred_ssh_interactive_callback)(void *, ...); #endif /** @@ -76,6 +81,16 @@ typedef struct git_cred_ssh_key { } git_cred_ssh_key; /** + * Keyboard-interactive based ssh authentication + */ +typedef struct git_cred_ssh_interactive { + git_cred parent; + char *username; + void *prompt_callback; + void *payload; +} git_cred_ssh_interactive; + +/** * A key with a custom signature function */ typedef struct git_cred_ssh_custom { @@ -131,6 +146,21 @@ GIT_EXTERN(int) git_cred_ssh_key_new( const char *passphrase); /** + * Create a new ssh keyboard-interactive based credential object. + * The supplied credential parameter will be internally duplicated. + * + * @param username Username to use to authenticate. + * @param prompt_callback The callback method used for prompts. + * @param payload Additional data to pass to the callback. + * @return 0 for success or an error code for failure. + */ +GIT_EXTERN(int) git_cred_ssh_interactive_new( + git_cred **out, + const char *username, + git_cred_ssh_interactive_callback prompt_callback, + void *payload); + +/** * Create a new ssh key credential object used for querying an ssh-agent. * The supplied credential parameter will be internally duplicated. * |