diff options
author | Jeremy Allison <jra@samba.org> | 2001-11-23 11:18:20 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-11-23 11:18:20 +0000 |
commit | d05bbf042209b737e42a5daa8d59236d351ec8d0 (patch) | |
tree | 343cca67678d4fa8a67157515f15494f89aaa19e /source3/nsswitch | |
parent | d2e279ecf2b767a1f5dc119484383f694680e691 (diff) | |
download | samba-d05bbf042209b737e42a5daa8d59236d351ec8d0.tar.gz samba-d05bbf042209b737e42a5daa8d59236d351ec8d0.tar.bz2 samba-d05bbf042209b737e42a5daa8d59236d351ec8d0.zip |
Fixed delete on close bug. Added core dump code to winbindd.
Jeremy.
(This used to be commit a58d0f91f9ee7354c01a9c20cfe178d5dc02142d)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/winbindd.c | 59 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_misc.c | 3 |
2 files changed, 59 insertions, 3 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index ad3d4e7ac3..c1402dc8fb 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -23,6 +23,8 @@ #include "winbindd.h" +extern pstring debugf; + /* List of all connected clients */ struct winbindd_cli_state *client_list; @@ -53,6 +55,57 @@ static BOOL reload_services_file(BOOL test) return(ret); } +#if DUMP_CORE + +/**************************************************************************** ** + Prepare to dump a core file - carefully! + **************************************************************************** */ + +static BOOL dump_core(void) +{ + char *p; + pstring dname; + pstrcpy( dname, debugf ); + if ((p=strrchr(dname,'/'))) + *p=0; + pstrcat( dname, "/corefiles" ); + mkdir( dname, 0700 ); + sys_chown( dname, getuid(), getgid() ); + chmod( dname, 0700 ); + if ( chdir(dname) ) + return( False ); + umask( ~(0700) ); + +#ifdef HAVE_GETRLIMIT +#ifdef RLIMIT_CORE + { + struct rlimit rlp; + getrlimit( RLIMIT_CORE, &rlp ); + rlp.rlim_cur = MAX( 4*1024*1024, rlp.rlim_cur ); + setrlimit( RLIMIT_CORE, &rlp ); + getrlimit( RLIMIT_CORE, &rlp ); + DEBUG( 3, ( "Core limits now %d %d\n", (int)rlp.rlim_cur, (int)rlp.rlim_max ) ); + } +#endif +#endif + + DEBUG(0,("Dumping core in %s\n",dname)); + abort(); + return( True ); +} /* dump_core */ +#endif + +/**************************************************************************** ** + Handle a fault.. + **************************************************************************** */ + +static void fault_quit(void) +{ +#if DUMP_CORE + dump_core(); +#endif +} + static void winbindd_status(void) { struct winbindd_cli_state *tmp; @@ -672,7 +725,6 @@ struct winbindd_state server_state; /* Server state information */ int main(int argc, char **argv) { extern pstring global_myname; - extern pstring debugf; int accept_sock; BOOL interactive = False; int opt, new_debuglevel = -1; @@ -682,6 +734,7 @@ int main(int argc, char **argv) CatchSignal(SIGUSR1, SIG_IGN); + fault_setup((void (*)(void *))fault_quit ); snprintf(debugf, sizeof(debugf), "%s/log.winbindd", dyn_LOGFILEBASE); /* Initialise for running in non-root mode */ @@ -735,6 +788,10 @@ int main(int argc, char **argv) *p = 0; } + + DEBUG(1, ("winbindd version %s started.\n", VERSION ) ); + DEBUGADD( 1, ( "Copyright The Samba Team 2000-2001\n" ) ); + if (!reload_services_file(False)) { DEBUG(0, ("error opening config file\n")); exit(1); diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c index 95c4f29c18..2718a75385 100644 --- a/source3/nsswitch/winbindd_misc.c +++ b/source3/nsswitch/winbindd_misc.c @@ -119,8 +119,7 @@ enum winbindd_result winbindd_list_trusted_domains(struct winbindd_cli_state /* Skip own domain */ - if (strequal(domain->name, lp_workgroup())) - continue; + if (strequal(domain->name, lp_workgroup())) continue; /* Add domain to list */ |