Author: jpeach
Date: 2006-05-16 02:50:49 +0000 (Tue, 16 May 2006)
New Revision: 15631

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15631

Log:
Add a new option "enable core files". Administrators can use this to
disable automatic core file dumping. Core files are enabled by default.

Modified:
   branches/SAMBA_3_0/source/lib/fault.c
   branches/SAMBA_3_0/source/param/loadparm.c
   trunk/source/lib/fault.c
   trunk/source/param/loadparm.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/fault.c
===================================================================
--- branches/SAMBA_3_0/source/lib/fault.c       2006-05-16 01:21:16 UTC (rev 
15630)
+++ branches/SAMBA_3_0/source/lib/fault.c       2006-05-16 02:50:49 UTC (rev 
15631)
@@ -151,6 +151,15 @@
 
  void dump_core(void)
 {
+       /* Note that even if core dumping has been disabled, we still set up
+        * the core path. This is to handle the case where core dumping is
+        * turned on in smb.conf and the relevant daemon is not restarted.
+        */
+       if (!lp_enable_core_files()) {
+               DEBUG(0, ("Exiting on internal error (core file 
administratively disabled\n"));
+               exit(1);
+       }
+
        if (*corepath != '\0') {
                /* The chdir might fail if we dump core before we finish
                 * processing the config file.

Modified: branches/SAMBA_3_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_0/source/param/loadparm.c  2006-05-16 01:21:16 UTC (rev 
15630)
+++ branches/SAMBA_3_0/source/param/loadparm.c  2006-05-16 02:50:49 UTC (rev 
15631)
@@ -289,6 +289,7 @@
        BOOL bDebugHiresTimestamp;
        BOOL bDebugPid;
        BOOL bDebugUid;
+       BOOL bEnableCoreFiles;
        BOOL bHostMSDfs;
        BOOL bUseMmap;
        BOOL bHostnameLookups;
@@ -947,6 +948,7 @@
        {"debug hires timestamp", P_BOOL, P_GLOBAL, 
&Globals.bDebugHiresTimestamp, NULL, NULL, FLAG_ADVANCED}, 
        {"debug pid", P_BOOL, P_GLOBAL, &Globals.bDebugPid, NULL, NULL, 
FLAG_ADVANCED}, 
        {"debug uid", P_BOOL, P_GLOBAL, &Globals.bDebugUid, NULL, NULL, 
FLAG_ADVANCED}, 
+       {"enable core files", P_BOOL, P_GLOBAL, &Globals.bEnableCoreFiles, 
NULL, NULL, FLAG_ADVANCED},
 
        {N_("Protocol Options"), P_SEP, P_SEPARATOR}, 
 
@@ -1504,6 +1506,7 @@
        Globals.bDebugHiresTimestamp = False;
        Globals.bDebugPid = False;
        Globals.bDebugUid = False;
+       Globals.bEnableCoreFiles = True;
        Globals.max_ttl = 60 * 60 * 24 * 3;     /* 3 days default. */
        Globals.max_wins_ttl = 60 * 60 * 24 * 6;        /* 6 days default. */
        Globals.min_wins_ttl = 60 * 60 * 6;     /* 6 hours default. */
@@ -1875,6 +1878,7 @@
 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
+FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)

Modified: trunk/source/lib/fault.c
===================================================================
--- trunk/source/lib/fault.c    2006-05-16 01:21:16 UTC (rev 15630)
+++ trunk/source/lib/fault.c    2006-05-16 02:50:49 UTC (rev 15631)
@@ -151,6 +151,15 @@
 
  void dump_core(void)
 {
+       /* Note that even if core dumping has been disabled, we still set up
+        * the core path. This is to handle the case where core dumping is
+        * turned on in smb.conf and the relevant daemon is not restarted.
+        */
+       if (!lp_enable_core_files()) {
+               DEBUG(0, ("Exiting on internal error (core file 
administratively disabled\n"));
+               exit(1);
+       }
+
        if (*corepath != '\0') {
                /* The chdir might fail if we dump core before we finish
                 * processing the config file.

Modified: trunk/source/param/loadparm.c
===================================================================
--- trunk/source/param/loadparm.c       2006-05-16 01:21:16 UTC (rev 15630)
+++ trunk/source/param/loadparm.c       2006-05-16 02:50:49 UTC (rev 15631)
@@ -289,6 +289,7 @@
        BOOL bDebugHiresTimestamp;
        BOOL bDebugPid;
        BOOL bDebugUid;
+       BOOL bEnableCoreFiles;
        BOOL bHostMSDfs;
        BOOL bUseMmap;
        BOOL bHostnameLookups;
@@ -947,6 +948,7 @@
        {"debug hires timestamp", P_BOOL, P_GLOBAL, 
&Globals.bDebugHiresTimestamp, NULL, NULL, FLAG_ADVANCED}, 
        {"debug pid", P_BOOL, P_GLOBAL, &Globals.bDebugPid, NULL, NULL, 
FLAG_ADVANCED}, 
        {"debug uid", P_BOOL, P_GLOBAL, &Globals.bDebugUid, NULL, NULL, 
FLAG_ADVANCED}, 
+       {"enable core files", P_BOOL, P_GLOBAL, &Globals.bEnableCoreFiles, 
NULL, NULL, FLAG_ADVANCED},
 
        {N_("Protocol Options"), P_SEP, P_SEPARATOR}, 
 
@@ -1504,6 +1506,7 @@
        Globals.bDebugHiresTimestamp = False;
        Globals.bDebugPid = False;
        Globals.bDebugUid = False;
+       Globals.bEnableCoreFiles = True;
        Globals.max_ttl = 60 * 60 * 24 * 3;     /* 3 days default. */
        Globals.max_wins_ttl = 60 * 60 * 24 * 6;        /* 6 days default. */
        Globals.min_wins_ttl = 60 * 60 * 6;     /* 6 hours default. */
@@ -1875,6 +1878,7 @@
 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
+FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)

Reply via email to