Commit Graph

171 Commits

Author SHA1 Message Date
Daniel Stenberg d45ed0ecf5 SSH: acknowledge speedcheck
Check for speedcheck limits during the state machine traversals
2011-01-05 14:09:53 +01:00
Daniel Stenberg adb49ad8bb Curl_timeleft: s/conn/data in first argument
As the function doesn't really use the connectdata struct but only the
SessionHanadle struct I modified what argument it wants.
2011-01-04 23:13:10 +01:00
Daniel Stenberg 45cea71968 SSH: avoid PATH_MAX with alloc
We cannot assume that PATH_MAX will be enough for the remote path name
so allocating room for it is the only sensible approach.
2011-01-03 13:36:45 +01:00
Daniel Stenberg 1ad5764feb SFTP: make pwd output result to header callback
Sending "pwd" as a QUOTE command only sent the reply to the
DEBUGFUNCTION. Now it also sends an FTP-like header to the header
callback to allow similar operations as with FTP, and apps can re-use
the same parser.
2011-01-01 15:35:53 +01:00
Luke Amery 0dc8479b89 ssh: honour the CURLINFO_FTP_ENTRY_PATH curl_getinfo option 2010-12-30 23:42:44 +01:00
Kamil Dudka 5c7c9a768d url: provide dead_connection flag in Curl_handler::disconnect
It helps to prevent a hangup with some FTP servers in case idle session
timeout has exceeded.  But it may be useful also for other protocols
that send any quit message on disconnect.  Currently used by FTP, POP3,
IMAP and SMTP.
2010-12-06 14:35:42 +01:00
Yang Tse bf1c102b80 ssh: fix a download resume point calculation 2010-12-06 14:29:16 +01:00
Yang Tse c1901f7ed0 fix compiler warning: conversion may lose significant bits 2010-12-04 05:53:07 +01:00
Yang Tse c2ba8ca81f s/isspace/ISSPACE 2010-11-26 13:59:01 +01:00
Daniel Stenberg e214cd4a73 SSH: use libssh2_session_handshake()
In libssh2 1.2.8, libssh2_session_handshake() replaces
libssh2_session_startup() to fix the previous portability problem with
the socket type that was too small for win64 and thus easily could cause
crashes and more.
2010-10-20 23:31:34 +02:00
Daniel Stenberg 5997f54a71 SSH: avoid using the libssh2_ prefix
It is a bad idea to use the public prefix used by another library and
now we realize that libssh2 introduces a symbol in the upcoming version
1.2.8 that conflicts with our static function named libssh2_free.
2010-10-20 23:29:37 +02:00
Daniel Stenberg 51b8d30dc4 SFTP: more ignoring negative file sizes
As the change in 5f0ae7a062 added a precaution against negative
file sizes that for some reason managed to get returned, this change now
introduces the same check at the second place in the code where the file
size from the libssh2 stat call is used.

This check might not be suitable for a 32 bit curl_off_t, but libssh2.h
assumes long long to work and to be 64 bit so I believe such a small
curl_off_t will be very unlikely to occur in the wild.
2010-10-12 00:01:40 +02:00
Daniel Stenberg 5f0ae7a062 SFTP: avoid downloading negative sizes!
It is still not clarified exactly why this happens, but libssh2
sometimes report a negative file size for the remote SFTP file and that
deeply confuses libcurl (or crashes it) so this precaution is added to
avoid badness.

Reported by: Ernest Beinrohr
Bug: http://curl.haxx.se/bug/view.cgi?id=3076430
2010-09-30 23:08:37 +02:00
Yang Tse 992ceae386 build: fix libssh2_scp_send64() availability 2010-08-05 16:27:39 +02:00
Daniel Stenberg f8cf037ecf 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
2010-08-04 18:29:13 +02:00
Ben Greear affff47b3d ssh: Fix compile error on 64-bit systems.
Signed-off-by: Ben Greear <greearb@candelatech.com>
2010-07-21 21:31:37 +02:00
Daniel Stenberg 684830cb2a SSH: corrected the inability to respect the timeout
Jason McDonald posted bug report #3006786 when he found that the
SFTP code didn't timeout properly in several places in the code
even if a timeout was set properly.

Based on his suggested patch, I wrote a different implementation
that I think addressed the issue better and also uses the connect
timeout for the initial part of the SSH/SFTP done during the
"protocol connect" phase.

(http://curl.haxx.se/bug/view.cgi?id=3006786)
2010-06-02 23:33:51 +02:00
Howard Chu bc8fc9803f sendrecv: make them two pairs of send/recv to properly deal with FTPS
FTP(S) use two connections that can be set to different recv and
send functions independently, so by introducing recv+send pairs
in the same manner we already have sockets/connections we can
work with FTPS fine.

This commit fixes the FTPS regression introduced in change d64bd82.
2010-05-11 22:48:38 +02:00
Howard Chu d64bd82bdc sendrecv: split the I/O handling into private handler
Howard Chu brought the bulk work of this patch that properly
moves out the sending and recving of data to the parts of the
code that are properly responsible for the various ways of doing
so.

Daniel Stenberg assisted with polishing a few bits and fixed some
minor flaws in the original patch.

Another upside of this patch is that we now abuse CURLcodes less
with the "magic" -1 return codes and instead use CURLE_AGAIN more
consistently.
2010-05-07 15:05:34 +02:00
Daniel Stenberg c0111460b0 Curl_setup_transfer: no longer returns anything
This function could only return CURLE_OK and by changing it to
a void instead, we can simplify code all over.
2010-04-16 23:43:04 +02:00
Daniel Stenberg 9799dbebd6 sftp range: remove unnecessary check for NULL pointer 2010-04-16 23:20:50 +02:00
Ben Greear 7e22d6332b Fix compile warnings in ssh.c
strlen() returns size_t, but ssh libraries are wanting 'unsigned int'.  Add
explicit casts and use _ex versions of the ssh library calls.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2010-03-29 16:09:09 +02:00
Daniel Stenberg 2309b4e330 remove the CVSish $Id$ lines 2010-03-24 11:02:54 +01:00
Yang Tse 5695c4db86 fix compiler warning 2010-02-24 00:03:06 +00:00
Daniel Stenberg 846b926a3f corected a comment and wrapped a few longish lines 2010-02-20 21:41:25 +00:00
Yang Tse 7aef172a34 fix printf-style format strings 2010-02-04 19:44:31 +00:00
Daniel Stenberg 9bc897f380 Andre Guibert de Bruet improved the libssh2 error code translation 2010-01-26 12:25:03 +00:00
Daniel Stenberg d17416190b ssh_statemach_act() is now modified to loop over the switch() to perform as
much as possible in one go, as long as it doesn't block and hasn't reached the
end of the state machine.
This avoids spurious -1 returns from curl_multi_fdset() simply because
previously it would return from this function without anything in EWOUDLBLOCK
and thus basically it wasn't actually waiting for anything!!
2010-01-11 23:10:53 +00:00
Yang Tse 3184a91ec8 VMS specific preprocessor symbol checking adjustments 2009-12-30 17:59:56 +00:00
Yang Tse 59939313f8 Make usage of calloc()'s arguments consistent with rest of code base 2009-11-18 10:33:54 +00:00
Daniel Stenberg a76f4ab7dd - Liza Alenchery mentioned a problem with re-used SCP connection when a bad
auth is used, as it caused a crash. I failed to repeat the issue, but still
  made a change that now forces the TCP connection used for a freed SCP
  session to get closed and not be re-used.
2009-10-30 22:28:56 +00:00
Daniel Stenberg 86cec97b22 - Fixed memory leak in the SCP/SFTP code as it never freed the knownhosts
data!
2009-10-18 01:11:25 +00:00
Kamil Dudka 66fcebdc9e - Implemented a protocol independent way to specify blocking direction, used by
transfer.c for blocking. It is currently used only by SCP and SFTP protocols.
  This enhancement resolves an issue with 100% CPU usage during SFTP upload,
  reported by Vourhey.
2009-09-26 08:31:48 +00:00
Yang Tse d006efebc0 fix compiler warning: conversion to 'size_t' from 'curl_off_t' may alter its value 2009-09-17 15:06:34 +00:00
Daniel Stenberg 7a642c8bf1 - Daniel Johnson founded a flaw in the code convering sftp-errors to libcurl
errors.
2009-09-02 21:05:47 +00:00
Gunter Knauf 2f6ff57d96 blocked sshkeycallback() with HAVE_LIBSSH2_KNOWNHOST_API to avoid compiler warnings. 2009-07-23 02:15:00 +00:00
Daniel Stenberg 47c392e135 - Added CURLOPT_SSH_KNOWNHOSTS, CURLOPT_SSH_KEYFUNCTION, CURLOPT_SSH_KEYDATA.
They introduce known_host support for SSH keys to libcurl. See docs for
  details.
2009-07-22 22:49:01 +00:00
Dan Fandrich a9a89c604a Fixed a compiler warning. 2009-06-27 06:05:08 +00:00
Yang Tse 2c16681225 Adjusted to take in account that...
With the curl memory tracking feature decoupled from the debug build feature,
CURLDEBUG and DEBUGBUILD preprocessor symbol definitions are used as follows:

CURLDEBUG used for curl debug memory tracking specific code (--enable-curldebug)

DEBUGBUILD used for debug enabled specific code (--enable-debug)
2009-06-10 02:49:42 +00:00
Gunter Knauf 1bb68cbcfa changed ssh.c to use HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION define provided by libssh2.h; removed related define block from ssh.h. 2009-05-19 23:21:25 +00:00
Daniel Stenberg 3aa3d7e629 Internal cleanup: KEEP_WRITE and KEEP_READ are now called KEEP_SEND and
KEEP_RECV to better match the general terminology: receive and send is what we
do from the (remote) servers. We read and write from and to the local fs.
2009-05-11 07:53:38 +00:00
Daniel Stenberg e01b7c1ede - Bug report #2709004 (http://curl.haxx.se/bug/view.cgi?id=2709004) by Tim
Chen pointed out how curl couldn't upload with resume when reading from a
  pipe.

  This ended up with the introduction of a new return code for the
  CURLOPT_SEEKFUNCTION callback that basically says that the seek failed but
  that libcurl may try to resolve the situation anyway. In our case this means
  libcurl will attempt to instead read that much data from the stream instead
  of seeking and that way curl can now upload with resume when data is read
  from a stream!
2009-04-28 11:19:10 +00:00
Yang Tse 33a3753c3f libcurl's memory.h renamed to curl_memory.h 2009-04-21 11:46:16 +00:00
Yang Tse 9cc6ab3922 use HAVE_LIMITS_H symbol to protect limits.h inclusion 2009-04-14 13:50:32 +00:00
Gunter Knauf 122b0bfe82 silent 'unused' warnings. 2008-12-28 05:49:39 +00:00
Daniel Stenberg eab8c0d754 libssh2_sftp_seek2 was just renamed to libssh2_sftp_seek64 ... 2008-12-22 13:21:23 +00:00
Daniel Stenberg 7ffe62d901 - Given a recent enough libssh2, libcurl can now seek/resume with SFTP even
on file indexes beyond 2 or 4GB.
2008-12-22 13:12:36 +00:00
Daniel Stenberg 460459e8db oops, removing debug output that wasn't supposed to be there 2008-12-19 22:27:11 +00:00
Daniel Stenberg 07416b61e3 - Using the libssh2 0.19 function libssh2_session_block_directions(), libcurl
now has an improved ability to do right when the multi interface (both
  "regular" and multi_socket) is used for SCP and SFTP transfers. This should
  result in (much) less busy-loop situations and thus less CPU usage with no
  speed loss.
2008-12-19 21:14:52 +00:00
Daniel Stenberg 03ca98b0df - SCP and SFTP with the multi interface had the same flaw: the 'DONE'
operation didn't complete properly if the EAGAIN equivalent was returned but
  libcurl would simply continue with a half-completed close operation
  performed. This ruined persistent connection re-use and cause some
  SSH-protocol errors in general. The correction is unfortunately adding a
  blocking function - doing it entirely non-blocking should be considered for
  a better fix.
2008-12-17 12:32:41 +00:00