Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jul 18, 2024
1 parent 9c1e7e2 commit 79b064a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ static char* get_password(SEXP cb, const char *url, const char **username, int r
return strdup(CHAR(STRING_ELT(res, 1)));
}

char custom_callback_error[1000] = {0};
static int get_key_files(SEXP cb, auth_key_data *out, int verbose){
if(!Rf_isFunction(cb))
Rf_error("cb must be a function");
Expand All @@ -88,7 +87,9 @@ static int get_key_files(SEXP cb, auth_key_data *out, int verbose){
R_tryEvalSilent(call, R_GlobalEnv, &err));
if(err || !Rf_isString(res)){
if(res && Rf_inherits(res, "try-error")){
char custom_callback_error[1000] = {0};
snprintf(custom_callback_error, 999, "SSH authentication failure: %s", CHAR(STRING_ELT(res, 0)));
giterr_set_str(GIT_ERROR_CALLBACK, custom_callback_error);
}
UNPROTECT(2);
return -1;
Expand Down Expand Up @@ -175,7 +176,7 @@ static int auth_callback(git_cred **cred, const char *url, const char *username,
auth_callback_data_t *cb_data = payload;
const char * ssh_user = username ? username : "git";
int verbose = cb_data->verbose;
strncpy(custom_callback_error, "Authentication failure", 23);
giterr_set_str(GIT_ERROR_CALLBACK, "Authentication failure");

#if AT_LEAST_LIBGIT2(0, 20)

Expand Down Expand Up @@ -237,7 +238,6 @@ static int auth_callback(git_cred **cred, const char *url, const char *username,
}
print_if_verbose("All authentication methods failed\n");
failure:
giterr_set_str(GIT_ERROR_CALLBACK, custom_callback_error);
return GIT_EAUTH;
}

Expand Down

0 comments on commit 79b064a

Please sign in to comment.