Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:09:35

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_git_credential_helpers_h__
0008 #define INCLUDE_git_credential_helpers_h__
0009 
0010 #include "transport.h"
0011 
0012 /**
0013  * @file git2/credential_helpers.h
0014  * @brief Utility functions for credential management
0015  * @defgroup git_credential_helpers credential management helpers
0016  * @ingroup Git
0017  * @{
0018  */
0019 GIT_BEGIN_DECL
0020 
0021 /**
0022  * Payload for git_credential_userpass_plaintext.
0023  */
0024 typedef struct git_credential_userpass_payload {
0025     const char *username;
0026     const char *password;
0027 } git_credential_userpass_payload;
0028 
0029 
0030 /**
0031  * Stock callback usable as a git_credential_acquire_cb.  This calls
0032  * git_cred_userpass_plaintext_new unless the protocol has not specified
0033  * `GIT_CREDENTIAL_USERPASS_PLAINTEXT` as an allowed type.
0034  *
0035  * @param out The newly created credential object.
0036  * @param url The resource for which we are demanding a credential.
0037  * @param user_from_url The username that was embedded in a "user\@host"
0038  *                          remote url, or NULL if not included.
0039  * @param allowed_types A bitmask stating which credential types are OK to return.
0040  * @param payload The payload provided when specifying this callback.  (This is
0041  *        interpreted as a `git_credential_userpass_payload*`.)
0042  * @return 0 or an error code.
0043  */
0044 GIT_EXTERN(int) git_credential_userpass(
0045         git_credential **out,
0046         const char *url,
0047         const char *user_from_url,
0048         unsigned int allowed_types,
0049         void *payload);
0050 
0051 /** @} */
0052 GIT_END_DECL
0053 #endif