aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh.c
AgeCommit message (Collapse)Author
2012-03-08CONNECT: made generically not per-protocolDaniel Stenberg
Curl_protocol_connect() now does the tunneling through the HTTP proxy if requested instead of letting each protocol specific connection function do it.
2012-03-08ssh_connect: tunnel through HTTP proxy if requestedDaniel Stenberg
2012-01-13ssh.c: fix compiler warningYang Tse
2011-12-31just a stupid typoDaniel Stenberg
2011-12-31SFTP dir: increase buffer size counterDaniel Stenberg
When the buffer gets realloced to hold the file name in the SSH_SFTP_READDIR_LINK state, the counter was not bumped accordingly. Reported by: Armel Asselin Patch by: Armel Asselin Bug: http://curl.haxx.se/mail/lib-2011-12/0249.html
2011-12-24SFTP mkdir: use correct permissionDaniel Stenberg
When sending quote command to a SFTP server and 'mkdir' was used, it would send fixed permissions and not use the CURLOPT_NEW_DIRECTORY_PERMS as it should. Reported by: Armel Patch by: Armel Bug: http://curl.haxx.se/mail/lib-2011-12/0249.html
2011-12-05SSH: fix CURLOPT_SSH_HOST_PUBLIC_KEY_MD5Daniel Stenberg
When a 32 digit hex key is given as a hostkey md5 checksum, the code would still run it against the knownhost check and not properly acknowledge that the md5 should then be the sole guide for. The verbose output now includes the evaluated MD5 hostkey checksum. Some related source code comments were also updated. Bug: http://curl.haxx.se/bug/view.cgi?id=3451592 Reported by: Reza Arbab
2011-11-24query-part: ignore the URI part for given protocolsJonas Schnelli
By setting PROTOPT_NOURLQUERY in the protocol handler struct, the protocol will get the "query part" of the URL cut off before the data is handled by the protocol-specific code. This makes libcurl adhere to RFC3986 section 2.2. Test 1220 is added to verify a file:// URL with query-part.
2011-11-18SFTP: support '*' prefix for quote operationsJonas Schnelli
prefixing a command with '*' means it is allowed to fail without aborting the chain actions
2011-10-21curl_multi_fdset: correct fdset with FTP PORT useDaniel Stenberg
After a PORT has been issued, and the multi handle would switch to the CURLM_STATE_DO_MORE state (which is unique for FTP), libcurl would return the wrong fdset to wait for when curl_multi_fdset() is called. The code would blindly assume that it was waiting for a connect of the second connection, while that isn't true immediately after the PORT command. Also, the function multi.c:domore_getsock() was highly FTP-centric and therefore ugly to keep in protocol-agnostic code. I solved this problem by introducing a new function pointer in the Curl_handler struct called domore_getsock() which is only called during the DOMORE state for protocols that set that pointer. The new ftp.c:ftp_domore_getsock() function now returns fdset info about the control connection's command/response handling while such a state is in use, and goes over to waiting for a writable second connection first once the commands are done. The original problem could be seen by running test 525 and checking the time stamps in the FTP server log. I can verify that this fix at least fixes this problem. Bug: http://curl.haxx.se/mail/lib-2011-10/0250.html Reported by: Gokhan Sengun
2011-09-10ssh.c: revert needless commit 7b7c45879eYang Tse
2011-09-08libssh2: use calloc as alloc function for libssh2 versions older than 1.3Yang Tse
This workarounds old libssh2 versions not properly initializing some ssh session variables, which would trigger memory debuggers warnings on memory being used without having been initialized.
2011-09-07ssh.c: fix memory leaks triggered upon OOM or other failuresYang Tse
2011-09-05fix bool variables checking and assignmentYang Tse
2011-09-03fix a bunch of MSVC compiler warningsYang Tse
2011-08-31ssh.c: fix realloc() OOM handlingYang Tse
2011-08-19tcpconnect: follow-up commit after b998d95bDaniel Stenberg
As I modified conn->bits.tcpconnect to become an array that holds one bool for each potential connection all uses of that struct field must index it correctly.
2011-08-19ssh.c: add PATH_MAX definition for WIN32Yang Tse
2011-07-26stdio.h, stdlib.h, string.h, stdarg.h and ctype.h inclusion done in setup_once.hYang Tse
2011-07-25WIN32 io.h and fcntl.h inclusion done in setup_once.hYang Tse
2011-07-25time.h and sys/time.h inclusion conditionally done in setup_once.hYang Tse
2011-07-04code style: space between close paren and open braceDaniel Stenberg
2011-06-04Curl_socket_ready: make timeout a 'long'Daniel Stenberg
It was mostly typecasted to int all over the code so switching to long instead all over should be a net gain.
2011-05-23compiler warning: fixYang Tse
Fix compiler warning: `keycheck' might be used uninitialized in this function. Fix compiler warning: `keybit' might be used uninitialized in this function.
2011-05-23compiler warning: fixYang Tse
Fix compiler warning: unused variable 'data'
2011-05-05RTSP: convert protocol-specific checks to genericDaniel Stenberg
Add a 'readwrite' function to the protocol handler struct and use that for the extra readwrite functionality RTSP needs.
2011-05-01SSH: set non-blocking earlierDaniel Stenberg
Introduce an INIT state for the SSH state machine and set libssh2 non-blocking in that so that it is set properly before libssh2_session_startup() is called. Bug: http://curl.haxx.se/mail/archive-2011-05/0001.html
2011-04-27SSH: move knownhost logic to separate functionDaniel Stenberg
2011-04-27source cleanup: unify look, style and indent levelsDaniel Stenberg
By the use of a the new lib/checksrc.pl script that checks that our basic source style rules are followed.
2011-04-20SFTP: close file before postquoteDaniel Stenberg
Make sure that files are closed before the post quote commands run as if they operate on the just transferred file they could otherwise easily fail. Patch by: Rajesh Naganathan (edited)
2011-04-20CURL_DOES_CONVERSIONS: cleanupDaniel Stenberg
Massively reduce #ifdefs all over (23 #ifdef lines less so far) Moved conversion-specific code to non-ascii.c
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.