Mercurial > dropbear
changeset 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 | 00e619aa2f9a |
children | 1d5a3df28b53 |
files | session.h svr-session.c |
diffstat | 2 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/session.h Tue Jun 16 15:22:33 2009 +0000 +++ b/session.h Thu Jul 09 16:01:30 2009 +0000 @@ -213,6 +213,10 @@ /* The numeric address they connected from, used for logging */ char * addrstring; +#ifdef __uClinux__ + pid_t server_pid; +#endif + }; typedef enum {
--- a/svr-session.c Tue Jun 16 15:22:33 2009 +0000 +++ b/svr-session.c Thu Jul 09 16:01:30 2009 +0000 @@ -85,6 +85,10 @@ /* 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 @@ _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);