comparison svr-session.c @ 553:8711f20b89ab

- For uclinux, only cleanup on exit for the main process. This avoids trashing the state when a failing child exits.
author Matt Johnston <matt@ucc.asn.au>
date Thu, 09 Jul 2009 16:01:30 +0000
parents 9f583f4d59a6
children 005530560594
comparison
equal deleted inserted replaced
545:00e619aa2f9a 553:8711f20b89ab
82 crypto_init(); 82 crypto_init();
83 common_session_init(sock, sock, remotehost); 83 common_session_init(sock, sock, remotehost);
84 84
85 /* Initialise server specific parts of the session */ 85 /* Initialise server specific parts of the session */
86 svr_ses.childpipe = childpipe; 86 svr_ses.childpipe = childpipe;
87 svr_ses.addrstring = addrstring;
88 #ifdef __uClinux__
89 svr_ses.server_pid = getpid();
90 #endif
87 svr_ses.addrstring = addrstring; 91 svr_ses.addrstring = addrstring;
88 svr_authinitialise(); 92 svr_authinitialise();
89 chaninitialise(svr_chantypes); 93 chaninitialise(svr_chantypes);
90 svr_chansessinitialise(); 94 svr_chansessinitialise();
91 95
142 "exit before auth: %s", format); 146 "exit before auth: %s", format);
143 } 147 }
144 148
145 _dropbear_log(LOG_INFO, fmtbuf, param); 149 _dropbear_log(LOG_INFO, fmtbuf, param);
146 150
147 /* free potential public key options */ 151 #ifdef __uClinux__
148 svr_pubkey_options_cleanup(); 152 /* only the main server process should cleanup - we don't want
149 153 * forked children doing that */
150 /* must be after we've done with username etc */ 154 if (svr_ses.server_pid == getpid())
151 common_session_cleanup(); 155 #else
156 if (1)
157 #endif
158 {
159 /* free potential public key options */
160 svr_pubkey_options_cleanup();
161
162 /* must be after we've done with username etc */
163 common_session_cleanup();
164 }
152 165
153 exit(exitcode); 166 exit(exitcode);
154 167
155 } 168 }
156 169