diff options
| author | Patrick Steinhardt <ps@pks.im> | 2020-01-30 10:40:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-30 10:40:44 +0100 |
| commit | aa4cd778b97d7271aa0ad12a4f9d492c443d5935 (patch) | |
| tree | da7cc7d3a92f8e1c06e47876b574fc86cbd73eaf /include/git2/sys | |
| parent | f9b41a6600f35f36ba5381f355355c303bd05df1 (diff) | |
| parent | 3f54ba8b61869f42b2bbd1a60091a0be640bc8fc (diff) | |
| download | libgit2-aa4cd778b97d7271aa0ad12a4f9d492c443d5935.tar.gz | |
Merge pull request #5336 from libgit2/ethomson/credtype
cred: change enum to git_credential_t and GIT_CREDENTIAL_*
Diffstat (limited to 'include/git2/sys')
| -rw-r--r-- | include/git2/sys/cred.h | 83 | ||||
| -rw-r--r-- | include/git2/sys/credential.h | 90 | ||||
| -rw-r--r-- | include/git2/sys/transport.h | 4 |
3 files changed, 96 insertions, 81 deletions
diff --git a/include/git2/sys/cred.h b/include/git2/sys/cred.h index 7636e79e4..4d2a59af7 100644 --- a/include/git2/sys/cred.h +++ b/include/git2/sys/cred.h @@ -7,84 +7,9 @@ #ifndef INCLUDE_sys_git_cred_h__ #define INCLUDE_sys_git_cred_h__ -#include "git2/common.h" -#include "git2/cred.h" - -/** - * @file git2/sys/cred.h - * @brief Git credentials low-level implementation - * @defgroup git_cred Git credentials low-level implementation - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * The base structure for all credential types - */ -struct git_cred { - git_credtype_t credtype; /**< A type of credential */ - - /** The deallocator for this type of credentials */ - void GIT_CALLBACK(free)(git_cred *cred); -}; - -/** A plaintext username and password */ -struct git_cred_userpass_plaintext { - git_cred parent; /**< The parent cred */ - char *username; /**< The username to authenticate as */ - char *password; /**< The password to use */ -}; - -/** Username-only credential information */ -struct git_cred_username { - git_cred parent; /**< The parent cred */ - char username[1]; /**< The username to authenticate as */ -}; - -/** - * A ssh key from disk - */ -struct git_cred_ssh_key { - git_cred parent; /**< The parent cred */ - char *username; /**< The username to authenticate as */ - char *publickey; /**< The path to a public key */ - char *privatekey; /**< The path to a private key */ - char *passphrase; /**< Passphrase used to decrypt the private key */ -}; - -/** - * Keyboard-interactive based ssh authentication - */ -struct git_cred_ssh_interactive { - git_cred parent; /**< The parent cred */ - char *username; /**< The username to authenticate as */ - - /** - * Callback used for authentication. - */ - git_cred_ssh_interactive_cb prompt_callback; - - void *payload; /**< Payload passed to prompt_callback */ -}; - -/** - * A key with a custom signature function - */ -struct git_cred_ssh_custom { - git_cred parent; /**< The parent cred */ - char *username; /**< The username to authenticate as */ - char *publickey; /**< The public key data */ - size_t publickey_len; /**< Length of the public key */ - - /** - * Callback used to sign the data. - */ - git_cred_sign_cb sign_callback; - - void *payload; /**< Payload passed to prompt_callback */ -}; - -GIT_END_DECL +/* These declarations have moved. */ +#ifndef GIT_DEPRECATE_HARD +# include "git2/sys/credential.h" +#endif #endif diff --git a/include/git2/sys/credential.h b/include/git2/sys/credential.h new file mode 100644 index 000000000..bb4c9f942 --- /dev/null +++ b/include/git2/sys/credential.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_sys_git_credential_h__ +#define INCLUDE_sys_git_credential_h__ + +#include "git2/common.h" +#include "git2/credential.h" + +/** + * @file git2/sys/cred.h + * @brief Git credentials low-level implementation + * @defgroup git_credential Git credentials low-level implementation + * @ingroup Git + * @{ + */ +GIT_BEGIN_DECL + +/** + * The base structure for all credential types + */ +struct git_credential { + git_credential_t credtype; /**< A type of credential */ + + /** The deallocator for this type of credentials */ + void GIT_CALLBACK(free)(git_credential *cred); +}; + +/** A plaintext username and password */ +struct git_credential_userpass_plaintext { + git_credential parent; /**< The parent credential */ + char *username; /**< The username to authenticate as */ + char *password; /**< The password to use */ +}; + +/** Username-only credential information */ +struct git_credential_username { + git_credential parent; /**< The parent credential */ + char username[1]; /**< The username to authenticate as */ +}; + +/** + * A ssh key from disk + */ +struct git_credential_ssh_key { + git_credential parent; /**< The parent credential */ + char *username; /**< The username to authenticate as */ + char *publickey; /**< The path to a public key */ + char *privatekey; /**< The path to a private key */ + char *passphrase; /**< Passphrase to decrypt the private key */ +}; + +/** + * Keyboard-interactive based ssh authentication + */ +struct git_credential_ssh_interactive { + git_credential parent; /**< The parent credential */ + char *username; /**< The username to authenticate as */ + + /** + * Callback used for authentication. + */ + git_credential_ssh_interactive_cb prompt_callback; + + void *payload; /**< Payload passed to prompt_callback */ +}; + +/** + * A key with a custom signature function + */ +struct git_credential_ssh_custom { + git_credential parent; /**< The parent credential */ + char *username; /**< The username to authenticate as */ + char *publickey; /**< The public key data */ + size_t publickey_len; /**< Length of the public key */ + + /** + * Callback used to sign the data. + */ + git_credential_sign_cb sign_callback; + + void *payload; /**< Payload passed to prompt_callback */ +}; + +GIT_END_DECL + +#endif diff --git a/include/git2/sys/transport.h b/include/git2/sys/transport.h index d7c7313af..6cee42f54 100644 --- a/include/git2/sys/transport.h +++ b/include/git2/sys/transport.h @@ -55,7 +55,7 @@ struct git_transport { int GIT_CALLBACK(connect)( git_transport *transport, const char *url, - git_cred_acquire_cb cred_acquire_cb, + git_credential_acquire_cb cred_acquire_cb, void *cred_acquire_payload, const git_proxy_options *proxy_opts, int direction, @@ -266,7 +266,7 @@ GIT_EXTERN(int) git_transport_smart_certificate_check(git_transport *transport, * refused to provide credentials and callers should behave as if no * callback was set), or < 0 for an error */ -GIT_EXTERN(int) git_transport_smart_credentials(git_cred **out, git_transport *transport, const char *user, int methods); +GIT_EXTERN(int) git_transport_smart_credentials(git_credential **out, git_transport *transport, const char *user, int methods); /** * Get a copy of the proxy options |
