From: Daniel Stenberg Date: Sun, 16 Oct 2022 10:58:55 +0000 (+0200) Subject: libssh: if sftp_init fails, don't get the sftp error code X-Git-Tag: curl-7_86_0~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bdaa6dd5ba9ad63379c73b53fc639ea39df505c4;p=thirdparty%2Fcurl.git libssh: if sftp_init fails, don't get the sftp error code This flow extracted the wrong code (sftp code instead of ssh code), and the code is sometimes (erroneously) returned as zero anyway, so skip getting it and set a generic error. Reported-by: David McLaughlin Fixes #9737 Closes #9740 --- diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 1afadbfa57..0105e4079c 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -963,10 +963,9 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) rc = sftp_init(sshc->sftp_session); if(rc != SSH_OK) { - rc = sftp_get_error(sshc->sftp_session); failf(data, "Failure initializing sftp session: %s", ssh_get_error(sshc->ssh_session)); - MOVE_TO_ERROR_STATE(sftp_error_to_CURLE(rc)); + MOVE_TO_ERROR_STATE(sftp_error_to_CURLE(SSH_FX_FAILURE)); break; } state(data, SSH_SFTP_REALPATH);