added new smb.conf option "panic action". see my samba-technical
[samba.git] / source3 / param / loadparm.c
index 1c0b044598f7d9862acb5d91b795f61fb3681118..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)
@@ -2298,67 +2302,46 @@ BOOL lp_snum_ok(int iService)
 
 
 /***************************************************************************
-auto-load some homes and printer services
+auto-load some home services
 ***************************************************************************/
 static void lp_add_auto_services(char *str)
 {
-  char *s;
-  char *p;
-  int homes, printers;
-
-  if (!str)
-    return;
-
-  s = strdup(str);
-  if (!s) return;
-
-  homes = lp_servicenumber(HOMES_NAME);
-  printers = lp_servicenumber(PRINTERS_NAME);
+       char *s;
+       char *p;
+       int homes;
 
-  for (p=strtok(s,LIST_SEP);p;p=strtok(NULL,LIST_SEP)) {
-         char *home = get_home_dir(p);
+       if (!str) return;
 
-         if (lp_servicenumber(p) >= 0) continue;
+       s = strdup(str);
+       if (!s) return;
 
-         if (home && homes >= 0) {
-                 lp_add_home(p,homes,home);
-                 continue;
-         }
-         
-         if (printers >= 0 && pcap_printername_ok(p,NULL)) {
-                 lp_add_printer(p,printers);
-         }
-  }
-  free(s);
+       homes = lp_servicenumber(HOMES_NAME);
+       
+       for (p=strtok(s,LIST_SEP);p;p=strtok(NULL,LIST_SEP)) {
+               char *home = get_home_dir(p);
+               
+               if (lp_servicenumber(p) >= 0) continue;
+               
+               if (home && homes >= 0) {
+                       lp_add_home(p,homes,home);
+               }
+       }
+       free(s);
 }
 
 /***************************************************************************
 auto-load one printer
 ***************************************************************************/
-static void lp_add_one_printer(char *name,char *comment)
-{
-  int printers = lp_servicenumber(PRINTERS_NAME);
-  int i;
-
-  if (lp_servicenumber(name) < 0)
-    {
-      lp_add_printer(name,printers);
-      if ((i=lp_servicenumber(name)) >= 0)
-       string_set(&iSERVICE(i).comment,comment);
-    }      
-}
-
-
-/***************************************************************************
-auto-load printer services
-***************************************************************************/
-static void lp_add_all_printers(void)
+void lp_add_one_printer(char *name,char *comment)
 {
-  int printers = lp_servicenumber(PRINTERS_NAME);
-
-  if (printers < 0) return;
+       int printers = lp_servicenumber(PRINTERS_NAME);
+       int i;
 
-  pcap_printer_fn(lp_add_one_printer);
+       if (lp_servicenumber(name) < 0)  {
+               lp_add_printer(name,printers);
+               if ((i=lp_servicenumber(name)) >= 0)
+                       string_set(&iSERVICE(i).comment,comment);
+       }
 }
 
 /***************************************************************************
@@ -2460,8 +2443,6 @@ BOOL lp_load(char *pszFname,BOOL global_only, BOOL save_defaults, BOOL add_ipc)
       bRetval = service_ok(iServiceIndex);        
 
   lp_add_auto_services(lp_auto_services());
-  if (lp_load_printers())
-    lp_add_all_printers();
 
   if (add_ipc)
          lp_add_ipc();
@@ -2540,26 +2521,6 @@ char *volume_label(int snum)
   return(ret);
 }
 
-#if 0
-/*
- * nmbd only loads the global section. There seems to be no way to
- * determine exactly is a service is printable by only looking at the
- * [global] section so for now always announce as a print server. This
- * will need looking at in the future. Jeremy (jallison@whistle.com).
- */
-/*******************************************************************
- Return true if any printer services are defined.
-  ******************************************************************/
-static BOOL lp_printer_services(void)
-{
-  int iService;
-
-  for (iService = iNumServices - 1; iService >= 0; iService--)
-      if (VALID(iService) && iSERVICE(iService).bPrint_ok)
-          return True;
-  return False;
-}
-#endif
 
 /*******************************************************************
  Set the server type we will announce as via nmbd.
@@ -2575,15 +2536,6 @@ static void set_default_server_announce_type()
   else if(lp_announce_as() == ANNOUNCE_AS_WFW)
     default_server_announce |= SV_TYPE_WFW;
   default_server_announce |= (lp_time_server() ? SV_TYPE_TIME_SOURCE : 0);
-/*
- * nmbd only loads the [global] section. There seems to be no way to
- * determine exactly if any service is printable by only looking at the
- * [global] section so for now always announce as a print server. This
- * will need looking at in the future. Jeremy (jallison@whistle.com).
- */
-#if 0
-  default_server_announce |= (lp_printer_services() ? SV_TYPE_PRINTQ_SERVER : 0);
-#endif
 }