Skip to content
Snippets Groups Projects
Commit 99e0597c authored by James Housley's avatar James Housley
Browse files

Convert Curl_ssh_connect() to run in a state machine for

LIBSSH2_APINO >= 200706012030.  More to come...
parent 3247ac19
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -27,6 +27,7 @@
#ifdef USE_LIBSSH2
CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done);
CURLcode Curl_ssh_multi_statemach(struct connectdata *conn, bool *done);
CURLcode Curl_scp_do(struct connectdata *conn, bool *done);
CURLcode Curl_scp_done(struct connectdata *conn, CURLcode, bool premature);
......
......@@ -406,6 +406,29 @@ struct ftp_conn {
ftpstate state; /* always use ftp.c:state() to change state! */
};
/****************************************************************************
* SSH unique setup
***************************************************************************/
typedef enum {
SSH_STOP, /* do nothing state, stops the state machine */
SSH_S_STARTUP, /* Session startup */
SSH_AUTHLIST,
SSH_AUTH_PKEY_INIT,
SSH_AUTH_PKEY,
SSH_AUTH_PASS_INIT,
SSH_AUTH_PASS,
SSH_AUTH_HOST_INIT,
SSH_AUTH_HOST,
SSH_AUTH_KEY_INIT,
SSH_AUTH_KEY,
SSH_AUTH_DONE,
SSH_SFTP_INIT,
SSH_SFTP_REALPATH,
SSH_GET_WORKINGPATH,
SSH_QUIT,
SSH_LAST /* never used */
} sshstate;
struct SSHPROTO {
curl_off_t *bytecountp;
char *user;
......@@ -421,6 +444,17 @@ struct SSHPROTO {
#endif /* USE_LIBSSH2 */
};
/* ssh_conn is used for struct connection-oriented data in the connectdata
struct */
struct ssh_conn {
const char *authlist; /* List of auth. methods, managed by libssh2 */
const char *passphrase;
char rsa_pub[PATH_MAX];
char rsa[PATH_MAX];
bool authed;
sshstate state; /* always use ssh.c:state() to change state! */
};
/****************************************************************************
* FILE unique setup
......@@ -900,6 +934,7 @@ struct connectdata {
union {
struct ftp_conn ftpc;
struct ssh_conn sshc;
} proto;
int cselect_bits; /* bitmask of socket events */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment