summaryrefslogtreecommitdiffstats
path: root/source/nsswitch/winbindd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-11-23 11:18:20 +0000
committerJeremy Allison <jra@samba.org>2001-11-23 11:18:20 +0000
commita58d0f91f9ee7354c01a9c20cfe178d5dc02142d (patch)
tree19d04fc5fea53466514c53dcc93e594999b37e7e /source/nsswitch/winbindd.c
parent20a4167599ce211f239d0f324e7e73a1c2d8a5a6 (diff)
downloadsamba-a58d0f91f9ee7354c01a9c20cfe178d5dc02142d.tar.gz
samba-a58d0f91f9ee7354c01a9c20cfe178d5dc02142d.tar.xz
samba-a58d0f91f9ee7354c01a9c20cfe178d5dc02142d.zip
Fixed delete on close bug. Added core dump code to winbindd.
Jeremy.
Diffstat (limited to 'source/nsswitch/winbindd.c')
-rw-r--r--source/nsswitch/winbindd.c59
1 files changed, 58 insertions, 1 deletions
diff --git a/source/nsswitch/winbindd.c b/source/nsswitch/winbindd.c
index ad3d4e7ac31..c1402dc8fb6 100644
--- a/source/nsswitch/winbindd.c
+++ b/source/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);