From 99e0597c7b74a8be4c85819554b7a1eb447f5ed5 Mon Sep 17 00:00:00 2001 From: James Housley Date: Tue, 12 Jun 2007 12:31:10 +0000 Subject: Convert Curl_ssh_connect() to run in a state machine for LIBSSH2_APINO >= 200706012030. More to come... --- lib/urldata.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'lib/urldata.h') diff --git a/lib/urldata.h b/lib/urldata.h index 023bc3ca3..83053fbcf 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -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 */ -- cgit v1.2.3