comparison cli-session.c @ 45:9ee8996a375f

Pubkey auth is mostly there for the client. Something strange with remote hostkey verification though.
author Matt Johnston <matt@ucc.asn.au>
date Tue, 03 Aug 2004 17:26:56 +0000
parents 942b22d7dd1c
children 4b53a43f0082
comparison
equal deleted inserted replaced
44:45edf30ea0a6 45:9ee8996a375f
17 static void cli_session_init(); 17 static void cli_session_init();
18 static void cli_finished(); 18 static void cli_finished();
19 19
20 struct clientsession cli_ses; /* GLOBAL */ 20 struct clientsession cli_ses; /* GLOBAL */
21 21
22 /* Sorted in decreasing frequency will be more efficient - data and window
23 * should be first */
22 static const packettype cli_packettypes[] = { 24 static const packettype cli_packettypes[] = {
23 /* TYPE, AUTHREQUIRED, FUNCTION */ 25 /* TYPE, AUTHREQUIRED, FUNCTION */
24 {SSH_MSG_KEXINIT, recv_msg_kexinit},
25 {SSH_MSG_KEXDH_REPLY, recv_msg_kexdh_reply}, // client
26 {SSH_MSG_NEWKEYS, recv_msg_newkeys},
27 {SSH_MSG_SERVICE_ACCEPT, recv_msg_service_accept}, // client
28 {SSH_MSG_CHANNEL_DATA, recv_msg_channel_data}, 26 {SSH_MSG_CHANNEL_DATA, recv_msg_channel_data},
29 {SSH_MSG_CHANNEL_WINDOW_ADJUST, recv_msg_channel_window_adjust}, 27 {SSH_MSG_CHANNEL_WINDOW_ADJUST, recv_msg_channel_window_adjust},
28 {SSH_MSG_USERAUTH_FAILURE, recv_msg_userauth_failure}, /* client */
29 {SSH_MSG_USERAUTH_SUCCESS, recv_msg_userauth_success}, /* client */
30 {SSH_MSG_KEXINIT, recv_msg_kexinit},
31 {SSH_MSG_KEXDH_REPLY, recv_msg_kexdh_reply}, /* client */
32 {SSH_MSG_NEWKEYS, recv_msg_newkeys},
33 {SSH_MSG_SERVICE_ACCEPT, recv_msg_service_accept}, /* client */
30 {SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_remotetcp}, 34 {SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_remotetcp},
31 {SSH_MSG_CHANNEL_REQUEST, recv_msg_channel_request}, 35 {SSH_MSG_CHANNEL_REQUEST, recv_msg_channel_request},
32 {SSH_MSG_CHANNEL_OPEN, recv_msg_channel_open}, 36 {SSH_MSG_CHANNEL_OPEN, recv_msg_channel_open},
33 {SSH_MSG_CHANNEL_EOF, recv_msg_channel_eof}, 37 {SSH_MSG_CHANNEL_EOF, recv_msg_channel_eof},
34 {SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close}, 38 {SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close},
35 {SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation}, 39 {SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation},
36 {SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure}, 40 {SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure},
37 {SSH_MSG_USERAUTH_FAILURE, recv_msg_userauth_failure}, // client 41 {SSH_MSG_USERAUTH_BANNER, recv_msg_userauth_banner}, /* client */
38 {SSH_MSG_USERAUTH_SUCCESS, recv_msg_userauth_success}, // client 42 #ifdef DROPBEAR_PUBKEY_AUTH
39 {SSH_MSG_USERAUTH_BANNER, recv_msg_userauth_banner}, // client 43 {SSH_MSG_USERAUTH_PK_OK, recv_msg_userauth_pk_ok}, /* client */
44 #endif
40 {0, 0} /* End */ 45 {0, 0} /* End */
41 }; 46 };
42 47
43 static const struct ChanType *cli_chantypes[] = { 48 static const struct ChanType *cli_chantypes[] = {
44 /* &chan_tcpdirect etc, though need to only allow if we've requested 49 /* &chan_tcpdirect etc, though need to only allow if we've requested
143 return; 148 return;
144 149
145 /* userauth code */ 150 /* userauth code */
146 case SERVICE_AUTH_ACCEPT_RCVD: 151 case SERVICE_AUTH_ACCEPT_RCVD:
147 cli_auth_getmethods(); 152 cli_auth_getmethods();
148 cli_ses.state = USERAUTH_METHODS_SENT; 153 cli_ses.state = USERAUTH_REQ_SENT;
149 TRACE(("leave cli_sessionloop: sent userauth methods req")); 154 TRACE(("leave cli_sessionloop: sent userauth methods req"));
150 return; 155 return;
151 156
152 case USERAUTH_FAIL_RCVD: 157 case USERAUTH_FAIL_RCVD:
153 cli_auth_try(); 158 cli_auth_try();
159 cli_ses.state = USERAUTH_REQ_SENT;
154 TRACE(("leave cli_sessionloop: cli_auth_try")); 160 TRACE(("leave cli_sessionloop: cli_auth_try"));
155 return; 161 return;
156 162
157 /*
158 case USERAUTH_SUCCESS_RCVD: 163 case USERAUTH_SUCCESS_RCVD:
159 send_msg_service_request(SSH_SERVICE_CONNECTION); 164 send_msg_service_request(SSH_SERVICE_CONNECTION);
160 cli_ses.state = SERVICE_CONN_REQ_SENT; 165 cli_ses.state = SERVICE_CONN_REQ_SENT;
161 TRACE(("leave cli_sessionloop: sent ssh-connection service req")); 166 TRACE(("leave cli_sessionloop: sent ssh-connection service req"));
162 return; 167 return;
163 */ 168
164 169 case SERVICE_CONN_ACCEPT_RCVD:
170 cli_send_chansess_request();
171 TRACE(("leave cli_sessionloop: cli_send_chansess_request"));
172 cli_ses.state = SESSION_RUNNING;
173 return;
174
175 /*
165 case USERAUTH_SUCCESS_RCVD: 176 case USERAUTH_SUCCESS_RCVD:
166 cli_send_chansess_request(); 177 cli_send_chansess_request();
167 TRACE(("leave cli_sessionloop: cli_send_chansess_request")); 178 TRACE(("leave cli_sessionloop: cli_send_chansess_request"));
168 cli_ses.state = SESSION_RUNNING; 179 cli_ses.state = SESSION_RUNNING;
169 return; 180 return;
181 */
170 182
171 case SESSION_RUNNING: 183 case SESSION_RUNNING:
172 if (ses.chancount < 1) { 184 if (ses.chancount < 1) {
173 cli_finished(); 185 cli_finished();
174 } 186 }