1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-16 14:35:03 -05:00

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
This commit is contained in:
JDepooter 2019-01-16 17:18:20 -08:00 committed by Daniel Stenberg
parent 7c16871d0b
commit b095a1ca63
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -667,7 +667,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break; break;
} }
if(rc) { 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); state(conn, SSH_SESSION_FREE);
sshc->actualcode = CURLE_FAILED_INIT; sshc->actualcode = CURLE_FAILED_INIT;
break; break;