mirror of
https://github.com/git/git.git
synced 2024-11-15 05:33:04 +01:00
59b386526a
When we are trying to fill a credential, we loop over the set of defined credential-helpers, then fall back to running askpass, and then finally prompt on the terminal. Helpers which cannot find a credential are free to tell us nothing, but they cannot currently ask us to stop prompting. This patch lets them provide a "quit" attribute, which asks us to stop the process entirely (avoiding running more helpers, as well as the askpass/terminal prompt). This has a few possible uses: 1. A helper which prompts the user itself (e.g., in a dialog) can provide a "cancel" button to the user to stop further prompts. 2. Some helpers may know that prompting cannot possibly work. For example, if their role is to broker a ticket from an external auth system and that auth system cannot be contacted, there is no point in continuing (we need a ticket to authenticate, and the user cannot provide one by typing it in). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
35 lines
833 B
C
35 lines
833 B
C
#ifndef CREDENTIAL_H
|
|
#define CREDENTIAL_H
|
|
|
|
#include "string-list.h"
|
|
|
|
struct credential {
|
|
struct string_list helpers;
|
|
unsigned approved:1,
|
|
configured:1,
|
|
quit:1,
|
|
use_http_path:1;
|
|
|
|
char *username;
|
|
char *password;
|
|
char *protocol;
|
|
char *host;
|
|
char *path;
|
|
};
|
|
|
|
#define CREDENTIAL_INIT { STRING_LIST_INIT_DUP }
|
|
|
|
void credential_init(struct credential *);
|
|
void credential_clear(struct credential *);
|
|
|
|
void credential_fill(struct credential *);
|
|
void credential_approve(struct credential *);
|
|
void credential_reject(struct credential *);
|
|
|
|
int credential_read(struct credential *, FILE *);
|
|
void credential_write(const struct credential *, FILE *);
|
|
void credential_from_url(struct credential *, const char *url);
|
|
int credential_match(const struct credential *have,
|
|
const struct credential *want);
|
|
|
|
#endif /* CREDENTIAL_H */
|