Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:36

0001 /*
0002  * Copyright (C) the libgit2 contributors. All rights reserved.
0003  *
0004  * This file is part of libgit2, distributed under the GNU GPL v2 with
0005  * a Linking Exception. For full terms see the included COPYING file.
0006  */
0007 #ifndef INCLUDE_sys_git_credential_h__
0008 #define INCLUDE_sys_git_credential_h__
0009 
0010 #include "git2/common.h"
0011 #include "git2/credential.h"
0012 
0013 /**
0014  * @file git2/sys/cred.h
0015  * @brief Git credentials low-level implementation
0016  * @defgroup git_credential Git credentials low-level implementation
0017  * @ingroup Git
0018  * @{
0019  */
0020 GIT_BEGIN_DECL
0021 
0022 /**
0023  * The base structure for all credential types
0024  */
0025 struct git_credential {
0026     git_credential_t credtype; /**< A type of credential */
0027 
0028     /** The deallocator for this type of credentials */
0029     void GIT_CALLBACK(free)(git_credential *cred);
0030 };
0031 
0032 /** A plaintext username and password */
0033 struct git_credential_userpass_plaintext {
0034     git_credential parent; /**< The parent credential */
0035     char *username;        /**< The username to authenticate as */
0036     char *password;        /**< The password to use */
0037 };
0038 
0039 /** Username-only credential information */
0040 struct git_credential_username {
0041     git_credential parent; /**< The parent credential */
0042     char username[1];      /**< The username to authenticate as */
0043 };
0044 
0045 /**
0046  * A ssh key from disk
0047  */
0048 struct git_credential_ssh_key {
0049     git_credential parent; /**< The parent credential */
0050     char *username;        /**< The username to authenticate as */
0051     char *publickey;       /**< The path to a public key */
0052     char *privatekey;      /**< The path to a private key */
0053     char *passphrase;      /**< Passphrase to decrypt the private key */
0054 };
0055 
0056 /**
0057  * Keyboard-interactive based ssh authentication
0058  */
0059 struct git_credential_ssh_interactive {
0060     git_credential parent; /**< The parent credential */
0061     char *username;        /**< The username to authenticate as */
0062 
0063     /**
0064      * Callback used for authentication.
0065      */
0066     git_credential_ssh_interactive_cb prompt_callback;
0067 
0068     void *payload;         /**< Payload passed to prompt_callback */
0069 };
0070 
0071 /**
0072  * A key with a custom signature function
0073  */
0074 struct git_credential_ssh_custom {
0075     git_credential parent; /**< The parent credential */
0076     char *username;        /**< The username to authenticate as */
0077     char *publickey;       /**< The public key data */
0078     size_t publickey_len;  /**< Length of the public key */
0079 
0080     /**
0081      * Callback used to sign the data.
0082      */
0083     git_credential_sign_cb sign_callback;
0084 
0085     void *payload;         /**< Payload passed to prompt_callback */
0086 };
0087 
0088 GIT_END_DECL
0089 
0090 #endif