summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/git-access.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/git-access.c b/core/git-access.c
index 2b7fa0ca2..dba9cbec5 100644
--- a/core/git-access.c
+++ b/core/git-access.c
@@ -194,9 +194,20 @@ int credential_ssh_cb(git_cred **out,
(void) url;
(void) allowed_types;
(void) payload;
+ static int attempt = 0;
const char *priv_key = format_string("%s/%s", system_default_directory(), "ssrf_remote.key");
const char *passphrase = prefs.cloud_storage_password ? strdup(prefs.cloud_storage_password) : strdup("");
+
+ /* Bail out from libgit authentication loop when credentials are
+ * incorrect */
+
+ if (attempt++ > 2) {
+ report_error("Authentication to cloud storage failed.");
+ attempt = 0;
+ return GIT_EUSER;
+ }
+
return git_cred_ssh_key_new(out, username_from_url, NULL, priv_key, passphrase);
}
@@ -210,8 +221,18 @@ int credential_https_cb(git_cred **out,
(void) username_from_url;
(void) payload;
(void) allowed_types;
+ static int attempt = 0;
const char *username = prefs.cloud_storage_email_encoded;
const char *password = prefs.cloud_storage_password ? strdup(prefs.cloud_storage_password) : strdup("");
+
+ /* Bail out from libgit authentication loop when credentials are
+ * incorrect */
+
+ if (attempt++ > 2) {
+ report_error("Authentication to cloud storage failed.");
+ attempt = 0;
+ return GIT_EUSER;
+ }
return git_cred_userpass_plaintext_new(out, username, password);
}