aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-08-04 17:23:38 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-08-04 18:29:13 +0200
commitf8cf037ecf67d4dc490e0e54fb2c691211e859ba (patch)
treeb1e25f66a563d18a7b199312392454b624ddd644 /lib/ssh.c
parent6028fdb3053657ae0bd099b704eca0e108ed9b7d (diff)
SCP: send large files properly with new enough libssh2
libssh2 1.2.6 and later handle >32bit file sizes properly even on 32bit architectures and we make sure to use that ability. Reported by: Mikael Johansson Bug: http://curl.haxx.se/mail/lib-2010-08/0052.html
Diffstat (limited to 'lib/ssh.c')
-rw-r--r--lib/ssh.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 67995058a..fe8c16a24 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -486,6 +486,17 @@ static int sshkeycallback(CURL *easy,
#endif
/*
+ * Earlier libssh2 versions didn't do SCP properly beyond 32bit sizes on 32bit
+ * architectures so we check of the necessary function is present.
+ */
+#ifdef HAVE_LIBSSH2_SCP_SEND64
+#define SCP_SEND(a,b,c,d) libssh2_scp_send_ex(a, b, (int)(c), (size_t)d, 0, 0)
+#else
+#define SCP_SEND(a,b,c,d) libssh2_scp_send64(a, b, (int)(c), \
+ (libssh2_uint64_t)d, 0, 0)
+#endif
+
+/*
* ssh_statemach_act() runs the SSH state machine as far as it can without
* blocking and without reaching the end. The data the pointer 'block' points
* to will be set to TRUE if the libssh2 function returns LIBSSH2_ERROR_EAGAIN
@@ -2083,9 +2094,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
* directory in the path.
*/
sshc->ssh_channel =
- libssh2_scp_send_ex(sshc->ssh_session, sftp_scp->path,
- (int)(data->set.new_file_perms),
- (size_t)data->set.infilesize, 0, 0);
+ SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms,
+ data->set.infilesize);
if(!sshc->ssh_channel) {
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {