comparison common-session.c @ 1129:45830474d83c coverity

merge up to date, attempt to fix travis.yml
author Matt Johnston <matt@ucc.asn.au>
date Fri, 12 Jun 2015 23:02:15 +0800
parents 6aeadee3f16b
children 43a8ea69b24c
comparison
equal deleted inserted replaced
1077:26c1f9b8f82e 1129:45830474d83c
1 /* 1 /*
2 * Dropbear - a SSH2 server 2 * Dropbear - a SSH2 server
3 * 3 *
4 * Copyright (c) 2002,2003 Matt Johnston 4 * Copyright (c) Matt Johnston
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal 8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights 9 * in the Software without restriction, including without limitation the rights
88 setnonblocking(ses.signal_pipe[1]); 88 setnonblocking(ses.signal_pipe[1]);
89 89
90 ses.maxfd = MAX(ses.maxfd, ses.signal_pipe[0]); 90 ses.maxfd = MAX(ses.maxfd, ses.signal_pipe[0]);
91 ses.maxfd = MAX(ses.maxfd, ses.signal_pipe[1]); 91 ses.maxfd = MAX(ses.maxfd, ses.signal_pipe[1]);
92 92
93 kexfirstinitialise(); /* initialise the kex state */
94
95 ses.writepayload = buf_new(TRANS_MAX_PAYLOAD_LEN); 93 ses.writepayload = buf_new(TRANS_MAX_PAYLOAD_LEN);
96 ses.transseq = 0; 94 ses.transseq = 0;
97 95
98 ses.readbuf = NULL; 96 ses.readbuf = NULL;
99 ses.payload = NULL; 97 ses.payload = NULL;
278 if (!sessinitdone) { 276 if (!sessinitdone) {
279 TRACE(("leave session_cleanup: !sessinitdone")) 277 TRACE(("leave session_cleanup: !sessinitdone"))
280 return; 278 return;
281 } 279 }
282 280
283 /* Beware of changing order of functions here. */ 281 /* BEWARE of changing order of functions here. */
284 282
285 /* Must be before extra_session_cleanup() */ 283 /* Must be before extra_session_cleanup() */
286 chancleanup(); 284 chancleanup();
287 285
288 if (ses.extra_session_cleanup) { 286 if (ses.extra_session_cleanup) {
289 ses.extra_session_cleanup(); 287 ses.extra_session_cleanup();
290 } 288 }
291 289
292 /* After these are freed most functions will exit */ 290 /* After these are freed most functions will fail */
293 #ifdef DROPBEAR_CLEANUP 291 #ifdef DROPBEAR_CLEANUP
294 /* listeners call cleanup functions, this should occur before 292 /* listeners call cleanup functions, this should occur before
295 other session state is freed. */ 293 other session state is freed. */
296 remove_all_listeners(); 294 remove_all_listeners();
297 295
327 TRACE(("leave session_cleanup")) 325 TRACE(("leave session_cleanup"))
328 } 326 }
329 327
330 void send_session_identification() { 328 void send_session_identification() {
331 buffer *writebuf = buf_new(strlen(LOCAL_IDENT "\r\n") + 1); 329 buffer *writebuf = buf_new(strlen(LOCAL_IDENT "\r\n") + 1);
332 buf_putbytes(writebuf, LOCAL_IDENT "\r\n", strlen(LOCAL_IDENT "\r\n")); 330 buf_putbytes(writebuf, (const unsigned char *) LOCAL_IDENT "\r\n", strlen(LOCAL_IDENT "\r\n"));
333 writebuf_enqueue(writebuf, 0); 331 writebuf_enqueue(writebuf, 0);
334 } 332 }
335 333
336 static void read_session_identification() { 334 static void read_session_identification() {
337 /* max length of 255 chars */ 335 /* max length of 255 chars */