added new smb.conf option "panic action". see my samba-technical
authorAndrew Tridgell <tridge@samba.org>
Fri, 21 Aug 1998 11:37:40 +0000 (11:37 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 21 Aug 1998 11:37:40 +0000 (11:37 +0000)
explanation.

source/include/proto.h
source/include/smb.h
source/lib/fault.c
source/lib/util.c
source/param/loadparm.c
source/smbd/ipc.c

index a4cac1c2f8e6a66b51825a0b684e89db7f3113b6..b89bb088dcfe8ae6a5b9e816d1484decc5dbb867 100644 (file)
@@ -327,7 +327,7 @@ struct hostent *Get_Hostbyname(char *name);
 BOOL process_exists(int pid);
 char *uidtoname(int uid);
 char *gidtoname(int gid);
-void ajt_panic(void);
+void smb_panic(char *why);
 char *readdirname(void *p);
 BOOL is_in_path(char *name, name_compare_entry *namelist);
 void set_namearray(name_compare_entry **ppname_array, char *namelist);
@@ -901,6 +901,7 @@ char *lp_nis_home_map_name(void);
 char *lp_announce_version(void);
 char *lp_netbios_aliases(void);
 char *lp_driverfile(void);
+char *lp_panic_action(void);
 char *lp_domain_sid(void);
 char *lp_domain_other_sids(void);
 char *lp_domain_groups(void);
index 9d6c8d7e29508558968608896ff43d3b953a77cb..a11a3ac61f1f45f4ff9a26c7c96e5f8df637cbc8 100644 (file)
@@ -1265,10 +1265,6 @@ void dfs_unlogin(void);
 extern int dcelogin_atmost_once;
 #endif
 
-#if AJT
-void ajt_panic(void);
-#endif
-
 #ifdef NOSTRDUP
 char *strdup(char *s);
 #endif
index 9b665f65c79e80a5267160a3e45c6285e452a3ee..6effaf7d7c6811854a17710f56629c3ff7a24567 100644 (file)
@@ -42,9 +42,7 @@ static void fault_report(int sig)
        DEBUG(0,("\nPlease read the file BUGS.txt in the distribution\n"));
        DEBUG(0,("===============================================================\n"));
   
-#if AJT
-       ajt_panic();
-#endif  
+       smb_panic("internal error");
 
        if (cont_fn) {
                cont_fn(NULL);
index c1eb7cc8798be6e0f2cda9e776ab0608c4567b16..9543388b458e25b5a06acf4aed5bab3b6650f735 100644 (file)
@@ -378,13 +378,11 @@ char *StrCpy(char *dest,char *src)
 {
   char *d = dest;
 
-#if AJT
   /* I don't want to get lazy with these ... */
   if (!dest || !src) {
-    DEBUG(0,("ERROR: NULL StrCpy() called!\n"));
-    ajt_panic();
+         DEBUG(0,("ERROR: NULL StrCpy() called!\n"));
+         smb_panic("invalid StrCpy");
   }
-#endif
 
   if (!dest) return(NULL);
   if (!src) {
@@ -4320,15 +4318,17 @@ char *gidtoname(int gid)
        return(name);
 }
 
-#if AJT
 /*******************************************************************
-my own panic function - not suitable for general use
+something really nasty happened - panic!
 ********************************************************************/
-void ajt_panic(void)
+void smb_panic(char *why)
 {
-       system("/usr/bin/X11/xedit -display :0 /tmp/ERROR_FAULT");
+       char *cmd = lp_panic_action();
+       if (cmd && *cmd) {
+               system(cmd);
+               exit(1);
+       }
 }
-#endif
 
 
 /*******************************************************************
index 6fcd1eaf9ba493f513c66f4147538be17e85bee4..765fae4f5c1dd11fb49c02fba48c032ba415a030 100644 (file)
@@ -152,6 +152,7 @@ typedef struct
   char *szLdapFilter;
   char *szLdapRoot;
   char *szLdapRootPassword; 
+  char *szPanicAction;
   int max_log_size;
   int mangled_stack;
   int max_xmit;
@@ -734,6 +735,8 @@ static struct parm_struct parm_table[] =
   {"dos filetime resolution",P_BOOL,P_LOCAL,&sDefault.bDosFiletimeResolution,   NULL,  NULL,  FLAG_GLOBAL},
   
   {"fake directory create times", P_BOOL,P_LOCAL,  &sDefault.bFakeDirCreateTimes, NULL,   NULL, FLAG_GLOBAL},
+  {"panic action",     P_STRING,  P_GLOBAL, &Globals.szPanicAction,     NULL,   NULL,  0},
+
   {NULL,               P_BOOL,    P_NONE,   NULL,                       NULL,   NULL, 0}
 };
 
@@ -1065,6 +1068,7 @@ FN_GLOBAL_STRING(lp_nis_home_map_name,&Globals.szNISHomeMapName)
 FN_GLOBAL_STRING(lp_announce_version,&Globals.szAnnounceVersion)
 FN_GLOBAL_STRING(lp_netbios_aliases,&Globals.szNetbiosAliases)
 FN_GLOBAL_STRING(lp_driverfile,&Globals.szDriverFile)
+FN_GLOBAL_STRING(lp_panic_action,&Globals.szPanicAction);
 
 FN_GLOBAL_STRING(lp_domain_sid,&Globals.szDomainSID)
 FN_GLOBAL_STRING(lp_domain_other_sids,&Globals.szDomainOtherSIDs)
index 1a6fb3366af66dba26175c684dfd577a9d3b5375..eb0abc37c0270c19997ae9f4397cbb4e7126bc3e 100644 (file)
@@ -377,9 +377,7 @@ va_dcl
     DEBUG(2,("type error in package: %s instead of %*s\n",str,
             strlen(str),p->curpos));
     va_end(args);
-#if AJT
-    ajt_panic();
-#endif  
+    smb_panic("invalid types in ipc");
     return 0;
   }
 #endif