1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

Move connection-oriented variables from the SessionHandle struct to the

connectdata struct. This will in theory enable us to do persistent connections
with SCP+SFTP, but currently the state machine always (and wrongly) cleanup
everything in the 'done' action instead of in 'disconnect'. Also did a bunch
of indent fixes, if () => if() and a few other source cleanups like added
comments etc.
This commit is contained in:
Daniel Stenberg 2007-11-05 09:30:45 +00:00
parent 51009a40b4
commit b9a7f4e502
2 changed files with 347 additions and 343 deletions

644
lib/ssh.c

File diff suppressed because it is too large Load Diff

View File

@ -485,6 +485,10 @@ typedef enum {
SSH_LAST /* never used */ SSH_LAST /* never used */
} sshstate; } sshstate;
/* this struct is used in the HandleData struct which is part of the
SessionHandle, which means this is used on a per-easy handle basis.
Everything that is strictly related to a connection is banned from this
struct. */
struct SSHPROTO { struct SSHPROTO {
curl_off_t *bytecountp; curl_off_t *bytecountp;
char *user; char *user;
@ -492,38 +496,42 @@ struct SSHPROTO {
char *path; /* the path we operate on */ char *path; /* the path we operate on */
char *homedir; char *homedir;
char *errorstr; char *errorstr;
#ifdef USE_LIBSSH2
LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
LIBSSH2_SFTP *sftp_session; /* SFTP handle */
LIBSSH2_SFTP_HANDLE *sftp_handle;
#endif /* USE_LIBSSH2 */
}; };
/* ssh_conn is used for struct connection-oriented data in the connectdata /* ssh_conn is used for struct connection-oriented data in the connectdata
struct */ struct */
struct ssh_conn { struct ssh_conn {
const char *authlist; /* List of auth. methods, managed by libssh2 */ const char *authlist; /* List of auth. methods, managed by libssh2 */
#ifdef USE_LIBSSH2 #ifdef USE_LIBSSH2
const char *passphrase; const char *passphrase; /* passphrase to use */
char *rsa_pub; char *rsa_pub; /* path name */
char *rsa; char *rsa; /* path name */
bool authed; bool authed; /* the connection has been authenticated fine */
sshstate state; /* always use ssh.c:state() to change state! */ sshstate state; /* always use ssh.c:state() to change state! */
sshstate nextState; /* the state to goto after stopping */ sshstate nextState; /* the state to goto after stopping */
CURLcode actualCode; /* the actual error code */ CURLcode actualCode; /* the actual error code */
struct curl_slist *quote_item; struct curl_slist *quote_item; /* for the quote option */
char *quote_path1; char *quote_path1; /* two generic pointers for the QUOTE stuff */
char *quote_path2; char *quote_path2;
LIBSSH2_SFTP_ATTRIBUTES quote_attrs; LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */
/* Here's a set of struct members used by the SFTP_READDIR state */
LIBSSH2_SFTP_ATTRIBUTES readdir_attrs; LIBSSH2_SFTP_ATTRIBUTES readdir_attrs;
char *readdir_filename; char *readdir_filename;
char *readdir_longentry; char *readdir_longentry;
int readdir_len, readdir_totalLen, readdir_currLen; int readdir_len, readdir_totalLen, readdir_currLen;
char *readdir_line; char *readdir_line;
char *readdir_linkPath; char *readdir_linkPath;
int secondCreateDirs; /* end of READDIR stuff */
char *slash_pos;
int secondCreateDirs; /* counter use by the code to see if the
second attempt has been made to change
to/create a directory */
char *slash_pos; /* used by the SFTP_CREATE_DIRS state */
LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
LIBSSH2_SFTP *sftp_session; /* SFTP handle */
LIBSSH2_SFTP_HANDLE *sftp_handle;
#endif /* USE_LIBSSH2 */ #endif /* USE_LIBSSH2 */
}; };