]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh: if sftp_init fails, don't get the sftp error code
authorDaniel Stenberg <daniel@haxx.se>
Sun, 16 Oct 2022 10:58:55 +0000 (12:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 16 Oct 2022 21:48:50 +0000 (23:48 +0200)
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

lib/vssh/libssh.c

index 1afadbfa5767c2f3f7f686f2ccf804c7ffa98e36..0105e4079cd09206f693adb4a014739752cb05e0 100644 (file)
@@ -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);