missed nmbd.c in previous update.
[samba.git] / source / nmbd / nmbd.c
index 8ab9f528efb6fa8c62529e7217f4977f9acb9515..40cb06aad4b78d8ea9328efaa9c766a334d2d4f7 100644 (file)
@@ -26,7 +26,6 @@
 */
 
 #include "includes.h"
-#include "loadparm.h"
 
 extern int DEBUGLEVEL;
 
@@ -56,21 +55,24 @@ extern struct in_addr ipzero;
 
 
  /****************************************************************************
-catch a sigterm
-****************************************************************************/
+  catch a sigterm
+  ****************************************************************************/
 static int sig_term()
 {
   BlockSignals(True);
   
   DEBUG(0,("Got SIGTERM: going down...\n"));
   
+  /* write out wins.dat file if samba is a WINS server */
   dump_names();
-  reload_services(True);
   
   /* remove all samba names, with wins server if necessary. */
   remove_my_names();
   
+  /* announce all server entries as 0 time-to-live, 0 type */
   /* XXXX don't care if we never receive a response back... yet */
+  remove_my_servers();
+
   /* XXXX other things: if we are a master browser, force an election? */
   
   exit(0);
@@ -205,6 +207,7 @@ BOOL reload_services(BOOL test)
   }
 
   load_interfaces();
+  add_subnet_interfaces();
 
   return(ret);
 }
@@ -287,9 +290,13 @@ static void load_hosts_file(char *fname)
          ipmask = *iface_nmask(ipaddr);
 
        if (group) {
-         add_domain_entry(ipaddr, ipmask, name, True);
+         add_subnet_entry(ipaddr, ipmask, name, True, True);
        } else {
-         add_netbios_entry(name,0x20,NB_ACTIVE,0,source,ipaddr);
+      struct subnet_record *d = find_subnet(ipaddr);
+      if (d)
+      {
+           add_netbios_entry(d,name,0x20,NB_ACTIVE,0,source,ipaddr,True,True);
+      }
        }
       }
     }
@@ -317,16 +324,19 @@ static void process(void)
       announce_host();
 
 #if 0
-      /* what was this stuff supposed to do? It sent
+      /* XXXX what was this stuff supposed to do? It sent
         ANN_GetBackupListReq packets which I think should only be
         sent when trying to find out who to browse with */      
+
       announce_backup();
 #endif
 
       announce_master();
 
+      query_refresh_names();
+
       expire_names_and_servers();
-      expire_netbios_response_entries(t-10);
+      expire_netbios_response_entries();
       refresh_my_names(t);
 
       write_browse_list();
@@ -447,7 +457,7 @@ static void usage(char *pname)
 
   fault_setup(fault_continue);
 
-  signal(SIGHUP,SIGNAL_CAST sig_hup);
+  signal(SIGHUP ,SIGNAL_CAST sig_hup);
   signal(SIGTERM,SIGNAL_CAST sig_term);
 
   while ((opt = getopt(argc, argv, "s:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:")) != EOF)
@@ -515,7 +525,7 @@ static void usage(char *pname)
     return(-1);        
 
   if (*group)
-    add_my_domains(group);
+    add_my_subnets(group);
 
   if (!is_daemon && !is_a_socket(0)) {
     DEBUG(0,("standard input is not a socket, assuming -D option\n"));
@@ -536,16 +546,22 @@ static void usage(char *pname)
     DEBUG(3,("Loaded hosts file\n"));
   }
 
+
+
   if (!*ServerComment)
     strcpy(ServerComment,"Samba %v");
   string_sub(ServerComment,"%v",VERSION);
   string_sub(ServerComment,"%h",myhostname);
 
   add_my_names();
-  add_my_domains(lp_workgroup());
+  add_my_subnets(lp_workgroup());
 
   DEBUG(3,("Checked names\n"));
   
+  load_netbios_names();
+
+  DEBUG(3,("Loaded names\n"));
+
   write_browse_list();
 
   DEBUG(3,("Dumped names\n"));