Subject: [libssh2] Patch to report the remote error message when using scp

[libssh2] Patch to report the remote error message when using scp

From: Gavrie Philipson <gavrie_at_philipson.co.il>
Date: Wed, 4 Jul 2007 17:08:48 +0300

Hi,

I'm using libssh2 (incidentally, together with curl) to upload a file
to a remote host using the SCP protocol
Now, if the remote side returns an error message such as "Permission
denied" or "No such file or directory", it is not reported by libssh2.
Instead, the generic message "Invalid ACK response from remote" is
reported.

The attached patch reads the remote error message, and reports it in a
way similar to the command-line scp(1) command.

To see its effect, when using curl normally, this is what happens on a
"Permission denied" error:

Without the patch:

curl -T /etc/shadow scp://user:pass_at_hostname/etc/shadow
...
curl: (2) failed init

With the patch:

curl -T /etc/shadow scp://user:pass_at_hostname/etc/shadow
...
curl: (79) scp: /etc/shadow: Permission denied

PS: To make curl print the error, I've generated a simple patch to
curl as well, which I'll post on the curl-library list.

-- Gavrie

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Received on 2007-07-04