From 038e3433d39337f736b7b69ac1e6212e9f8e5406 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 21 Aug 1998 11:37:40 +0000 Subject: added new smb.conf option "panic action". see my samba-technical explanation. (This used to be commit c6899df44c34088a4d2bf1edc840320b0ba7e32e) --- source3/include/proto.h | 3 ++- source3/include/smb.h | 4 ---- source3/lib/fault.c | 4 +--- source3/lib/util.c | 18 +++++++++--------- source3/param/loadparm.c | 4 ++++ source3/smbd/ipc.c | 4 +--- 6 files changed, 17 insertions(+), 20 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index a4cac1c2f8..b89bb088dc 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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); diff --git a/source3/include/smb.h b/source3/include/smb.h index 9d6c8d7e29..a11a3ac61f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -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 diff --git a/source3/lib/fault.c b/source3/lib/fault.c index 9b665f65c7..6effaf7d7c 100644 --- a/source3/lib/fault.c +++ b/source3/lib/fault.c @@ -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); diff --git a/source3/lib/util.c b/source3/lib/util.c index c1eb7cc879..9543388b45 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -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 /******************************************************************* diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 6fcd1eaf9b..765fae4f5c 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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) diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 1a6fb3366a..eb0abc37c0 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -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 -- cgit