Commit 0972443c by Vicent Marti

Merge pull request #2553 from libgit2/cmn/ssh-errors

ssh: store error message immediately after a failed agent call
parents 89e05e2a 2dc399a8
...@@ -292,6 +292,10 @@ static int ssh_agent_auth(LIBSSH2_SESSION *session, git_cred_ssh_key *c) { ...@@ -292,6 +292,10 @@ static int ssh_agent_auth(LIBSSH2_SESSION *session, git_cred_ssh_key *c) {
} }
shutdown: shutdown:
if (rc != LIBSSH2_ERROR_NONE)
ssh_error(session, "error authenticating");
libssh2_agent_disconnect(agent); libssh2_agent_disconnect(agent);
libssh2_agent_free(agent); libssh2_agent_free(agent);
...@@ -305,6 +309,7 @@ static int _git_ssh_authenticate_session( ...@@ -305,6 +309,7 @@ static int _git_ssh_authenticate_session(
int rc; int rc;
do { do {
giterr_clear();
switch (cred->credtype) { switch (cred->credtype) {
case GIT_CREDTYPE_USERPASS_PLAINTEXT: { case GIT_CREDTYPE_USERPASS_PLAINTEXT: {
git_cred_userpass_plaintext *c = (git_cred_userpass_plaintext *)cred; git_cred_userpass_plaintext *c = (git_cred_userpass_plaintext *)cred;
...@@ -361,6 +366,7 @@ static int _git_ssh_authenticate_session( ...@@ -361,6 +366,7 @@ static int _git_ssh_authenticate_session(
return GIT_EAUTH; return GIT_EAUTH;
if (rc != LIBSSH2_ERROR_NONE) { if (rc != LIBSSH2_ERROR_NONE) {
if (!giterr_last())
ssh_error(session, "Failed to authenticate SSH session"); ssh_error(session, "Failed to authenticate SSH session");
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment