Mercurial > dropbear
comparison cli-session.c @ 733:70811267715c
Run the cleanup handler also when we close due to TCP connection being closed
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 01 Apr 2013 22:26:55 +0800 |
parents | 9a5438271556 |
children | 619b1ed837fd |
comparison
equal
deleted
inserted
replaced
732:2e5f2bc60e40 | 733:70811267715c |
---|---|
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 static void recv_msg_service_accept(void); |
45 static void cli_session_cleanup(void); | |
45 | 46 |
46 struct clientsession cli_ses; /* GLOBAL */ | 47 struct clientsession cli_ses; /* GLOBAL */ |
47 | 48 |
48 /* Sorted in decreasing frequency will be more efficient - data and window | 49 /* Sorted in decreasing frequency will be more efficient - data and window |
49 * should be first */ | 50 * should be first */ |
141 cli_ses.cipher_none_after_auth = 0; | 142 cli_ses.cipher_none_after_auth = 0; |
142 #endif | 143 #endif |
143 | 144 |
144 /* For printing "remote host closed" for the user */ | 145 /* For printing "remote host closed" for the user */ |
145 ses.remoteclosed = cli_remoteclosed; | 146 ses.remoteclosed = cli_remoteclosed; |
147 ses.extra_session_cleanup = cli_session_cleanup; | |
146 ses.buf_match_algo = cli_buf_match_algo; | 148 ses.buf_match_algo = cli_buf_match_algo; |
147 | 149 |
148 /* packet handlers */ | 150 /* packet handlers */ |
149 ses.packettypes = cli_packettypes; | 151 ses.packettypes = cli_packettypes; |
150 | 152 |
288 | 290 |
289 TRACE2(("leave cli_sessionloop: fell out")) | 291 TRACE2(("leave cli_sessionloop: fell out")) |
290 | 292 |
291 } | 293 } |
292 | 294 |
293 void cli_session_cleanup() { | 295 static void cli_session_cleanup(void) { |
294 | 296 |
295 if (!sessinitdone) { | 297 if (!sessinitdone) { |
296 return; | 298 return; |
297 } | 299 } |
298 | 300 |
306 | 308 |
307 } | 309 } |
308 | 310 |
309 static void cli_finished() { | 311 static void cli_finished() { |
310 | 312 |
311 cli_session_cleanup(); | 313 session_cleanup(); |
312 common_session_cleanup(); | |
313 fprintf(stderr, "Connection to %s@%s:%s closed.\n", cli_opts.username, | 314 fprintf(stderr, "Connection to %s@%s:%s closed.\n", cli_opts.username, |
314 cli_opts.remotehost, cli_opts.remoteport); | 315 cli_opts.remotehost, cli_opts.remoteport); |
315 exit(cli_ses.retval); | 316 exit(cli_ses.retval); |
316 } | 317 } |
317 | 318 |