summaryrefslogtreecommitdiff
path: root/lib/ssh.c
Commit message (Collapse)AuthorAgeFilesLines
* CURL_DOES_CONVERSIONS: cleanupDaniel Stenberg2011-04-201-2/+0
| | | | | Massively reduce #ifdefs all over (23 #ifdef lines less so far) Moved conversion-specific code to non-ascii.c
* protocols: use CURLPROTO_ internallyDaniel Stenberg2011-03-141-7/+7
| | | | | | | | | | | 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.
* protocol handler: added flags fieldDaniel Stenberg2011-03-141-7/+9
| | | | | | | | | | | | | | | | | | | | 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.
* SSH: add protocol lock directionDaniel Stenberg2011-03-131-4/+11
| | | | | | | | | | | 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.
* ssh_statemach_act: set cselect for sftp uploadDaniel Stenberg2011-03-131-0/+5
| | | | | | | | 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.
* SFTP: gracefully handle shutdown earlyDaniel Stenberg2011-03-131-4/+8
| | | | | | | | | 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
* sftp upload: expire to advance state machineDaniel Stenberg2011-03-121-0/+5
| | | | | | | | | | | | 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>
* ssh_connect: treat libssh2 return code betterDaniel Stenberg2011-02-261-2/+1
| | | | | | | | | 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
* SSH: speedcheck clobbered existing errorDaniel Stenberg2011-01-061-1/+3
| | | | | The just added speedcheck must not ruin the error code if already set due to a problem.
* SSH: acknowledge speedcheckDaniel Stenberg2011-01-051-0/+6
| | | | Check for speedcheck limits during the state machine traversals
* Curl_timeleft: s/conn/data in first argumentDaniel Stenberg2011-01-041-1/+1
| | | | | As the function doesn't really use the connectdata struct but only the SessionHanadle struct I modified what argument it wants.
* SSH: avoid PATH_MAX with allocDaniel Stenberg2011-01-031-4/+8
| | | | | We cannot assume that PATH_MAX will be enough for the remote path name so allocating room for it is the only sensible approach.
* SFTP: make pwd output result to header callbackDaniel Stenberg2011-01-011-5/+9
| | | | | | | 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.
* ssh: honour the CURLINFO_FTP_ENTRY_PATH curl_getinfo optionLuke Amery2010-12-301-0/+3
|
* url: provide dead_connection flag in Curl_handler::disconnectKamil Dudka2010-12-061-4/+6
| | | | | | | 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.
* ssh: fix a download resume point calculationYang Tse2010-12-061-5/+5
|
* fix compiler warning: conversion may lose significant bitsYang Tse2010-12-041-11/+8
|
* s/isspace/ISSPACEYang Tse2010-11-261-1/+1
|
* SSH: use libssh2_session_handshake()Daniel Stenberg2010-10-201-0/+7
| | | | | | | 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.
* SSH: avoid using the libssh2_ prefixDaniel Stenberg2010-10-201-8/+9
| | | | | | 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.
* SFTP: more ignoring negative file sizesDaniel Stenberg2010-10-121-0/+5
| | | | | | | | | | | 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.
* SFTP: avoid downloading negative sizes!Daniel Stenberg2010-09-301-2/+5
| | | | | | | | | | 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
* build: fix libssh2_scp_send64() availabilityYang Tse2010-08-051-1/+1
|
* SCP: send large files properly with new enough libssh2Daniel Stenberg2010-08-041-3/+13
| | | | | | | | 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
* ssh: Fix compile error on 64-bit systems.Ben Greear2010-07-211-1/+1
| | | | Signed-off-by: Ben Greear <greearb@candelatech.com>
* SSH: corrected the inability to respect the timeoutDaniel Stenberg2010-06-021-8/+22
| | | | | | | | | | | | | 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)
* sendrecv: make them two pairs of send/recv to properly deal with FTPSHoward Chu2010-05-111-4/+4
| | | | | | | | | 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.
* sendrecv: split the I/O handling into private handlerHoward Chu2010-05-071-12/+34
| | | | | | | | | | | | | | 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.
* Curl_setup_transfer: no longer returns anythingDaniel Stenberg2010-04-161-10/+8
| | | | | This function could only return CURLE_OK and by changing it to a void instead, we can simplify code all over.
* sftp range: remove unnecessary check for NULL pointerDaniel Stenberg2010-04-161-1/+1
|
* Fix compile warnings in ssh.cBen Greear2010-03-291-50/+87
| | | | | | | 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>
* remove the CVSish $Id$ linesDaniel Stenberg2010-03-241-1/+0
|
* fix compiler warningYang Tse2010-02-241-3/+3
|
* corected a comment and wrapped a few longish linesDaniel Stenberg2010-02-201-13/+18
|
* fix printf-style format stringsYang Tse2010-02-041-2/+3
|
* Andre Guibert de Bruet improved the libssh2 error code translationDaniel Stenberg2010-01-261-2/+30
|
* ssh_statemach_act() is now modified to loop over the switch() to perform asDaniel Stenberg2010-01-111-1464/+1469
| | | | | | | | 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!!
* VMS specific preprocessor symbol checking adjustmentsYang Tse2009-12-301-1/+1
|
* Make usage of calloc()'s arguments consistent with rest of code baseYang Tse2009-11-181-1/+1
|
* - Liza Alenchery mentioned a problem with re-used SCP connection when a badDaniel Stenberg2009-10-301-0/+1
| | | | | | 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.
* - Fixed memory leak in the SCP/SFTP code as it never freed the knownhostsDaniel Stenberg2009-10-181-1/+9
| | | | data!
* - Implemented a protocol independent way to specify blocking direction, used byKamil Dudka2009-09-261-5/+25
| | | | | | 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.
* fix compiler warning: conversion to 'size_t' from 'curl_off_t' may alter its ↵Yang Tse2009-09-171-1/+1
| | | | value
* - Daniel Johnson founded a flaw in the code convering sftp-errors to libcurlDaniel Stenberg2009-09-021-4/+1
| | | | errors.
* blocked sshkeycallback() with HAVE_LIBSSH2_KNOWNHOST_API to avoid compiler ↵Gunter Knauf2009-07-231-0/+2
| | | | warnings.
* - Added CURLOPT_SSH_KNOWNHOSTS, CURLOPT_SSH_KEYFUNCTION, CURLOPT_SSH_KEYDATA.Daniel Stenberg2009-07-221-3/+154
| | | | | They introduce known_host support for SSH keys to libcurl. See docs for details.
* Fixed a compiler warning.Dan Fandrich2009-06-271-1/+1
|
* Adjusted to take in account that...Yang Tse2009-06-101-2/+2
| | | | | | | | | 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)
* changed ssh.c to use HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION define provided by ↵Gunter Knauf2009-05-191-4/+4
| | | | libssh2.h; removed related define block from ssh.h.
* Internal cleanup: KEEP_WRITE and KEEP_READ are now called KEEP_SEND andDaniel Stenberg2009-05-111-4/+4
| | | | | 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.