summaryrefslogtreecommitdiffhomepage
path: root/svr-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2009-07-09 16:01:30 +0000
committerMatt Johnston <matt@ucc.asn.au>2009-07-09 16:01:30 +0000
commita996e61a2e6b8ba4fb101a50c950a661cb6d770c (patch)
tree622d110fb930622e62c347ba3965fb3d1eff3165 /svr-session.c
parentcb82c6e3e0db91adc8aa65620935f4c9d57f70e9 (diff)
- For uclinux, only cleanup on exit for the main process. This avoids
trashing the state when a failing child exits. --HG-- extra : convert_revision : 5d029ce4602908c3becf0035cf2b7e62816959bc
Diffstat (limited to 'svr-session.c')
-rw-r--r--svr-session.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/svr-session.c b/svr-session.c
index eaccfe5..89b16cb 100644
--- a/svr-session.c
+++ b/svr-session.c
@@ -85,6 +85,10 @@ void svr_session(int sock, int childpipe,
/* Initialise server specific parts of the session */
svr_ses.childpipe = childpipe;
svr_ses.addrstring = addrstring;
+#ifdef __uClinux__
+ svr_ses.server_pid = getpid();
+#endif
+ svr_ses.addrstring = addrstring;
svr_authinitialise();
chaninitialise(svr_chantypes);
svr_chansessinitialise();
@@ -144,11 +148,20 @@ void svr_dropbear_exit(int exitcode, const char* format, va_list param) {
_dropbear_log(LOG_INFO, fmtbuf, param);
- /* free potential public key options */
- svr_pubkey_options_cleanup();
+#ifdef __uClinux__
+ /* only the main server process should cleanup - we don't want
+ * forked children doing that */
+ if (svr_ses.server_pid == getpid())
+#else
+ if (1)
+#endif
+ {
+ /* free potential public key options */
+ svr_pubkey_options_cleanup();
- /* must be after we've done with username etc */
- common_session_cleanup();
+ /* must be after we've done with username etc */
+ common_session_cleanup();
+ }
exit(exitcode);