summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJDepooter <joel.depooter@safe.com>2019-01-16 17:18:20 -0800
committerDaniel Stenberg <daniel@haxx.se>2019-01-17 15:03:16 +0100
commitb095a1ca63ab4962e7256616ff02607c5a77e089 (patch)
tree55366c7f654b6b3452a2f3716050343e3f6d7773
parent7c16871d0b26ae046da6194c1bc6eafe7985a19d (diff)
downloadcurl-b095a1ca63ab4962e7256616ff02607c5a77e089.tar.gz
ssh: log the libssh2 error message when ssh session startup fails
When a ssh session startup fails, it is useful to know why it has failed. This commit changes the message from: "Failure establishing ssh session" to something like this, for example: "Failure establishing ssh session: -5, Unable to exchange encryption keys" Closes #3481
-rw-r--r--lib/ssh.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index f3b0a58be..8c68adcc1 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -667,7 +667,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc) {
- failf(data, "Failure establishing ssh session");
+ char *err_msg = NULL;
+ (void)libssh2_session_last_error(sshc->ssh_session, &err_msg, NULL, 0);
+ failf(data, "Failure establishing ssh session: %d, %s", rc, err_msg);
+
state(conn, SSH_SESSION_FREE);
sshc->actualcode = CURLE_FAILED_INIT;
break;