aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh.c
AgeCommit message (Collapse)Author
2011-03-14protocols: use CURLPROTO_ internallyDaniel Stenberg
The PROT_* set of internal defines for the protocols is no longer used. We now use the same bits internally as we have defined in the public header using the CURLPROTO_ prefix. This is for simplicity and because the PROT_* prefix was already used duplicated internally for a set of KRB4 values. The PROTOPT_* defines were moved up to just below the struct definition within which they are used.
2011-03-14protocol handler: added flags fieldDaniel Stenberg
The protocol handler struct got a 'flags' field for special information and characteristics of the given protocol. This now enables us to move away central protocol information such as CLOSEACTION and DUALCHANNEL from single defines in a central place, out to each protocol's definition. It also made us stop abusing the protocol field for other info than the protocol, and we could start cleaning up other protocol-specific things by adding flags bits to set in the handler struct. The "protocol" field connectdata struct was removed as well and the code now refers directly to the conn->handler->protocol field instead. To make things work properly, the code now always store a conn->given pointer that points out the original handler struct so that the code can learn details from the original protocol even if conn->handler is modified along the way - for example when switching to go over a HTTP proxy.
2011-03-13SSH: add protocol lock directionDaniel Stenberg
Some protocols have to call the underlying functions without regard to what exact state the socket signals. For example even if the socket says "readable", the send function might need to be called while uploading, or vice versa. This is the case for libssh2 based protocols: SCP and SFTP and we now introduce a define to set those protocols and we make the multi interface code aware of this concept. This is another fix to make test 582 run properly.
2011-03-13ssh_statemach_act: set cselect for sftp uploadDaniel Stenberg
For uploads we want to use the _sending_ function even when the socket turns out readable as the underlying libssh2 sftp send function will deal with both accordingly. This is what the cselect_bits magic is for. Fixes test 582.
2011-03-13SFTP: gracefully handle shutdown earlyDaniel Stenberg
When using the multi interface and a handle using SFTP was removed very early on, we would get a segfault due to the code assumed data was there that hadn't yet been setup. Bug: http://curl.haxx.se/mail/lib-2011-03/0066.html Reported by: Saqib Ali
2011-03-12sftp upload: expire to advance state machineDaniel Stenberg
When using the multi_socket API to do SFTP upload, it is important that we set a quick expire when leaving the SSH_SFTP_UPLOAD_INIT state as there's nothing happening on the socket so there's no read or write to wait for, but the next libssh2 API function needs to be called to get the ball rolling. This is one of the problems detected by test 582. Reported by: Henry Ludemann <misc@hl.id.au>
2011-02-26ssh_connect: treat libssh2 return code betterDaniel Stenberg
libssh2_knownhost_readfile() returns a negative value on error or otherwise number of parsed known hosts - this was previously not documented correctly in the libssh2 man page for the function. Bug: http://curl.haxx.se/mail/lib-2011-02/0327.html Reported by: murat
2011-01-06SSH: speedcheck clobbered existing errorDaniel Stenberg
The just added speedcheck must not ruin the error code if already set due to a problem.
2011-01-05SSH: acknowledge speedcheckDaniel Stenberg
Check for speedcheck limits during the state machine traversals
2011-01-04Curl_timeleft: s/conn/data in first argumentDaniel Stenberg
As the function doesn't really use the connectdata struct but only the SessionHanadle struct I modified what argument it wants.
2011-01-03SSH: avoid PATH_MAX with allocDaniel Stenberg
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-01SFTP: make pwd output result to header callbackDaniel Stenberg
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.
2010-12-30ssh: honour the CURLINFO_FTP_ENTRY_PATH curl_getinfo optionLuke Amery
2010-12-06url: provide dead_connection flag in Curl_handler::disconnectKamil Dudka
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-06ssh: fix a download resume point calculationYang Tse
2010-12-04fix compiler warning: conversion may lose significant bitsYang Tse
2010-11-26s/isspace/ISSPACEYang Tse
2010-10-20SSH: use libssh2_session_handshake()Daniel Stenberg
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-20SSH: avoid using the libssh2_ prefixDaniel Stenberg
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-12SFTP: more ignoring negative file sizesDaniel Stenberg
As the change in 5f0ae7a0626cbe709 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-09-30SFTP: avoid downloading negative sizes!Daniel Stenberg
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-08-05build: fix libssh2_scp_send64() availabilityYang Tse
2010-08-04SCP: send large files properly with new enough libssh2Daniel Stenberg
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-07-21ssh: Fix compile error on 64-bit systems.Ben Greear
Signed-off-by: Ben Greear <greearb@candelatech.com>
2010-06-02SSH: corrected the inability to respect the timeoutDaniel Stenberg
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-05-11sendrecv: make them two pairs of send/recv to properly deal with FTPSHoward Chu
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-07sendrecv: split the I/O handling into private handlerHoward Chu
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-04-16Curl_setup_transfer: no longer returns anythingDaniel Stenberg
This function could only return CURLE_OK and by changing it to a void instead, we can simplify code all over.
2010-04-16sftp range: remove unnecessary check for NULL pointerDaniel Stenberg
2010-03-29Fix compile warnings in ssh.cBen Greear
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-24remove the CVSish $Id$ linesDaniel Stenberg
2010-02-24fix compiler warningYang Tse
2010-02-20corected a comment and wrapped a few longish linesDaniel Stenberg
2010-02-04fix printf-style format stringsYang Tse
2010-01-26Andre Guibert de Bruet improved the libssh2 error code translationDaniel Stenberg
2010-01-11ssh_statemach_act() is now modified to loop over the switch() to perform asDaniel Stenberg
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!!
2009-12-30VMS specific preprocessor symbol checking adjustmentsYang Tse
2009-11-18Make usage of calloc()'s arguments consistent with rest of code baseYang Tse
2009-10-30- Liza Alenchery mentioned a problem with re-used SCP connection when a badDaniel Stenberg
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-18- Fixed memory leak in the SCP/SFTP code as it never freed the knownhostsDaniel Stenberg
data!
2009-09-26- Implemented a protocol independent way to specify blocking direction, used byKamil Dudka
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-17fix compiler warning: conversion to 'size_t' from 'curl_off_t' may alter its ↵Yang Tse
value
2009-09-02- Daniel Johnson founded a flaw in the code convering sftp-errors to libcurlDaniel Stenberg
errors.
2009-07-23blocked sshkeycallback() with HAVE_LIBSSH2_KNOWNHOST_API to avoid compiler ↵Gunter Knauf
warnings.
2009-07-22- Added CURLOPT_SSH_KNOWNHOSTS, CURLOPT_SSH_KEYFUNCTION, CURLOPT_SSH_KEYDATA.Daniel Stenberg
They introduce known_host support for SSH keys to libcurl. See docs for details.
2009-06-27Fixed a compiler warning.Dan Fandrich
2009-06-10Adjusted to take in account that...Yang Tse
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-05-19changed ssh.c to use HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION define provided by ↵Gunter Knauf
libssh2.h; removed related define block from ssh.h.
2009-05-11Internal cleanup: KEEP_WRITE and KEEP_READ are now called KEEP_SEND andDaniel Stenberg
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-04-28- Bug report #2709004 (http://curl.haxx.se/bug/view.cgi?id=2709004) by TimDaniel Stenberg
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!