comparison cli-session.c @ 727:00bc3df3a9c3

Don't bother waiting for a ssh-connection service reply - the server will disconnect if it wasn't accepted
author Matt Johnston <matt@ucc.asn.au>
date Sun, 31 Mar 2013 21:38:17 +0800
parents 78eda530c000
children 9a5438271556
comparison
equal deleted inserted replaced
726:78eda530c000 727:00bc3df3a9c3
39 39
40 static void cli_remoteclosed(); 40 static void cli_remoteclosed();
41 static void cli_sessionloop(); 41 static void cli_sessionloop();
42 static void cli_session_init(); 42 static void cli_session_init();
43 static void cli_finished(); 43 static void cli_finished();
44 static void recv_msg_service_accept(void);
44 45
45 struct clientsession cli_ses; /* GLOBAL */ 46 struct clientsession cli_ses; /* GLOBAL */
46 47
47 /* Sorted in decreasing frequency will be more efficient - data and window 48 /* Sorted in decreasing frequency will be more efficient - data and window
48 * should be first */ 49 * should be first */
148 ses.packettypes = cli_packettypes; 149 ses.packettypes = cli_packettypes;
149 150
150 ses.isserver = 0; 151 ses.isserver = 0;
151 } 152 }
152 153
154 static void send_msg_service_request(char* servicename) {
155
156 TRACE(("enter send_msg_service_request: servicename='%s'", servicename))
157
158 CHECKCLEARTOWRITE();
159
160 buf_putbyte(ses.writepayload, SSH_MSG_SERVICE_REQUEST);
161 buf_putstring(ses.writepayload, servicename, strlen(servicename));
162
163 encrypt_packet();
164 TRACE(("leave send_msg_service_request"))
165 }
166
167 static void recv_msg_service_accept(void) {
168 // do nothing, if it failed then the server MUST have disconnected
169 }
170
153 /* This function drives the progress of the session - it initiates KEX, 171 /* This function drives the progress of the session - it initiates KEX,
154 * service, userauth and channel requests */ 172 * service, userauth and channel requests */
155 static void cli_sessionloop() { 173 static void cli_sessionloop() {
156 174
157 TRACE(("enter cli_sessionloop")) 175 TRACE(("enter cli_sessionloop"))
193 211
194 case STATE_NOTHING: 212 case STATE_NOTHING:
195 /* We've got the transport layer sorted, we now need to request 213 /* We've got the transport layer sorted, we now need to request
196 * userauth */ 214 * userauth */
197 send_msg_service_request(SSH_SERVICE_USERAUTH); 215 send_msg_service_request(SSH_SERVICE_USERAUTH);
198 cli_ses.state = SERVICE_AUTH_REQ_SENT;
199 TRACE(("leave cli_sessionloop: sent userauth service req"))
200 return;
201
202 /* userauth code */
203 case SERVICE_AUTH_ACCEPT_RCVD:
204 cli_auth_getmethods(); 216 cli_auth_getmethods();
205 cli_ses.state = USERAUTH_REQ_SENT; 217 cli_ses.state = USERAUTH_REQ_SENT;
206 TRACE(("leave cli_sessionloop: sent userauth methods req")) 218 TRACE(("leave cli_sessionloop: sent userauth methods req"))
207 return; 219 return;
208 220