out that SFTP requests didn't use persistent connections. Neither did SCP
ones.  I gave the SSH code a good beating and now both SCP and SFTP should
use persistent connections fine. I also did a bunch for indent changes as
well as a bug fix for the "keyboard interactive" auth.
This commit is contained in:
Daniel Stenberg 2007-11-08 10:22:49 +00:00
parent 61572a1f97
commit ba6f20a244
4 changed files with 1417 additions and 1401 deletions

View File

@ -6,6 +6,13 @@
Changelog
Daniel S (8 Nov 2007)
- Bug report #1823487 (http://curl.haxx.se/bug/view.cgi?id=1823487) pointed
out that SFTP requests didn't use persistent connections. Neither did SCP
ones. I gave the SSH code a good beating and now both SCP and SFTP should
use persistent connections fine. I also did a bunch for indent changes as
well as a bug fix for the "keyboard interactive" auth.
Dan F (6 Nov 2007)
- Improved telnet support by drastically reducing the number of write
callbacks needed to pass a buffer to the user. Instead one per byte it

View File

@ -4,7 +4,7 @@ Curl and libcurl 7.17.2
Command line options: 121
curl_easy_setopt() options: 147
Public functions in libcurl: 55
Public web site mirrors: 41
Public web site mirrors: 42
Known libcurl bindings: 36
Contributors: 597
@ -18,6 +18,7 @@ This release includes the following bugfixes:
with NSS, and also when SCP, SFTP and libz are not available
o free problem in the curl tool for users with empty home dir
o curl.h version 7.17.1 problem when building C++ apps with MSVC
o SFTP and SCP use persistent connections
This release includes the following known bugs:
@ -34,6 +35,6 @@ New curl mirrors:
This release would not have looked like this without help, code, reports and
advice from friends like these:
Dan Fandrich, Gisle Vanem, Toby Peterson
Dan Fandrich, Gisle Vanem, Toby Peterson, Yang Tse
Thanks! (and sorry if I forgot to mention someone)

2770
lib/ssh.c

File diff suppressed because it is too large Load Diff

View File

@ -431,7 +431,8 @@ struct ftp_conn {
typedef enum {
SSH_NO_STATE = -1, /* Used for "nextState" so say there is none */
SSH_STOP = 0, /* do nothing state, stops the state machine */
SSH_S_STARTUP, /* Session startup */
SSH_S_STARTUP, /* Session startup, First rate in SSH-CONNECT */
SSH_AUTHLIST,
SSH_AUTH_PKEY_INIT,
SSH_AUTH_PKEY,
@ -443,10 +444,10 @@ typedef enum {
SSH_AUTH_KEY,
SSH_AUTH_DONE,
SSH_SFTP_INIT,
SSH_SFTP_REALPATH,
SSH_GET_WORKINGPATH,
SSH_SFTP_QUOTE_INIT,
SSH_SFTP_POSTQUOTE_INIT,
SSH_SFTP_REALPATH, /* Last state in SSH-CONNECT */
SSH_SFTP_QUOTE_INIT, /* First state in SFTP-DO */
SSH_SFTP_POSTQUOTE_INIT, /* (Possibly) First state in SFTP-DONE */
SSH_SFTP_QUOTE,
SSH_SFTP_NEXT_QUOTE,
SSH_SFTP_QUOTE_STAT,
@ -467,20 +468,19 @@ typedef enum {
SSH_SFTP_READDIR_BOTTOM,
SSH_SFTP_READDIR_DONE,
SSH_SFTP_DOWNLOAD_INIT,
SSH_SFTP_DOWNLOAD_STAT,
SSH_SFTP_CLOSE,
SSH_SFTP_SHUTDOWN,
SSH_SCP_TRANS_INIT,
SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */
SSH_SFTP_CLOSE, /* Last state in SFTP-DONE */
SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */
SSH_SCP_TRANS_INIT, /* First state in SCP-DO */
SSH_SCP_UPLOAD_INIT,
SSH_SCP_DOWNLOAD_INIT,
SSH_SCP_DONE,
SSH_SCP_SEND_EOF,
SSH_SCP_WAIT_EOF,
SSH_SCP_WAIT_CLOSE,
SSH_SCP_CHANNEL_FREE,
SSH_CHANNEL_CLOSE,
SSH_SESSION_DISCONECT,
SSH_SESSION_FREE,
SSH_SCP_CHANNEL_FREE, /* Last state in SCP-DONE */
SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */
SSH_SESSION_FREE, /* Last state in SCP/SFTP-DISCONNECT */
SSH_QUIT,
SSH_LAST /* never used */
} sshstate;
@ -491,11 +491,7 @@ typedef enum {
struct. */
struct SSHPROTO {
curl_off_t *bytecountp;
char *user;
char *passwd;
char *path; /* the path we operate on */
char *homedir;
char *errorstr;
};
/* ssh_conn is used for struct connection-oriented data in the connectdata
@ -508,12 +504,14 @@ struct ssh_conn {
char *rsa; /* path name */
bool authed; /* the connection has been authenticated fine */
sshstate state; /* always use ssh.c:state() to change state! */
sshstate nextState; /* the state to goto after stopping */
CURLcode actualCode; /* the actual error code */
sshstate nextstate; /* the state to goto after stopping */
CURLcode actualcode; /* the actual error code */
struct curl_slist *quote_item; /* for the quote option */
char *quote_path1; /* two generic pointers for the QUOTE stuff */
char *quote_path2;
LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */
char *homedir; /* when doing SFTP we figure out home dir in the
connect phase */
/* Here's a set of struct members used by the SFTP_READDIR state */
LIBSSH2_SFTP_ATTRIBUTES readdir_attrs;