]> granicus.if.org Git - curl/commitdiff
libssh2: send the correct CURLE error code on scp file not found
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 26 Oct 2017 09:08:43 +0000 (11:08 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 1 Dec 2017 16:35:15 +0000 (17:35 +0100)
That also updates tests to expect the right error code

libssh2 back-end returns CURLE_SSH error if the remote file
is not found. Expect instead CURLE_REMOTE_FILE_NOT_FOUND
which is sent by the libssh backend.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
lib/ssh.c
tests/data/test605

index 54f08edf7bc962b8ffcacf368ee9972568628122..e0e88632d7ffea3fb85139ae7ab599e2da5b5a88 100644 (file)
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -261,6 +261,11 @@ static CURLcode libssh2_session_error_to_CURLE(int err)
     case LIBSSH2_ERROR_NONE:
       return CURLE_OK;
 
+    /* This is the error returned by libssh2_scp_recv2
+     * on unknown file */
+    case LIBSSH2_ERROR_SCP_PROTOCOL:
+      return CURLE_REMOTE_FILE_NOT_FOUND;
+
     case LIBSSH2_ERROR_SOCKET_NONE:
       return CURLE_COULDNT_CONNECT;
 
index 1c162fca597aae6e7c787e829d6c3ed9e5686137..94329a5287778439313014bf32d818e79d0d3052 100644 (file)
@@ -24,7 +24,7 @@ SCP retrieval of nonexistent file
 # Verify data after the test has been "shot"
 <verify>
 <errorcode>
-79
+78
 </errorcode>
 <valgrind>
 disable