'The mother of all checkins' :-). Jeremy Allison (jallison@whistle.com)
authorSamba Release Account <samba-bugs@samba.org>
Thu, 8 May 1997 01:14:17 +0000 (01:14 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Thu, 8 May 1997 01:14:17 +0000 (01:14 +0000)
Wed May  7 1997: Update for 1.9.17alpha1 release - 'browsefix release'
designed to make browsing across subnets work.

byteorder.h: Updated copyright to 1997.
charcnv.c:      Updated copyright to 1997.
charset.c  Updated copyright to 1997.
charset.h Updated copyright to 1997.
client.c Updated copyright to 1997.
clientutil.c Updated copyright to 1997.
dir.c Updated copyright to 1997.
fault.c Updated copyright to 1997.
includes.h Updated copyright to 1997.
interface.c Updated copyright to 1997.
ipc.c Updated copyright to 1997.
kanji.c Updated copyright to 1997.
kanji.h Updated copyright to 1997.
loadparm.c Updated copyright to 1997.
locking.c Updated copyright to 1997.
mangle.c Updated copyright to 1997.
message.c Updated copyright to 1997.
nameannounce.c

Made use of WINS subnet explicit.
Added reset_announce_timer() so announcement
can be made immediately when we become a master.
Expanded code to do sync with dmb.

namebrowse.c

Removed redundent checks for AM_MASTER in
sync code. Made use of WINS subnet explicit.

namedbname.c Made use of WINS subnet explicit.
namedbresp.c Made use of WINS subnet explicit.
namedbserver.c Made use of WINS subnet explicit.

namedbsubnet.c

Explicitly add workgroup to WINS subnet
when we become a dmb. Made use of WINS subnet explicit.

namedbwork.c

Made use of WINS subnet explicit. Removed
redundent check_work_servertype() function.

nameelect.c

Explicitly add workgroup to WINS subnet
when we become a master browser. Made use of WINS subnet explicit.

namelogon.c Updated copyright to 1997.
namepacket.c Updated copyright to 1997.
namequery.c Updated copyright to 1997.

nameresp.c

Made use of WINS subnet explicit. Made nmbd fail if
configured as master browser and one exists already.

nameserv.c

Made use of WINS subnet explicit. Remove redundent
logon server and domain master code.

nameserv.h Add emumerate subnet macros.
nameservreply.c Made use of WINS subnet explicit.
nameservresp.c Updated copyright to 1997.

namework.c

Made use of WINS subnet explicit. Updated code to
add sync browser entries to add subnet parameter.

nmbd.c

Added sanity check for misconfigured nmbd.

nmblib.c Updated copyright to 1997.
nmblookup.c Updated copyright to 1997.
nmbsync.c

Removed redundent AM_ANY_MASTER check.

params.c Updated copyright to 1997.
password.c Updated copyright to 1997.
pipes.c Updated copyright to 1997.
predict.c Updated copyright to 1997.
printing.c Updated copyright to 1997.

proto.h

Changed protos for new nmbd code.

quotas.c Updated copyright to 1997.
replace.c Updated copyright to 1997.
reply.c Updated copyright to 1997.
server.c Updated copyright to 1997.
shmem.c Updated copyright to 1997.
smb.h Updated copyright to 1997.
smbencrypt.c Updated copyright to 1997.
smbpasswd.c Updated copyright to 1997.
smbrun.c Updated copyright to 1997.
status.c Updated copyright to 1997.
system.c Updated copyright to 1997.
testparm.c Updated copyright to 1997.
testprns.c Updated copyright to 1997.
time.c Updated copyright to 1997.
trans2.c Updated copyright to 1997.
trans2.h Updated copyright to 1997.
uid.c Updated copyright to 1997.
username.c Updated copyright to 1997.
util.c Updated copyright to 1997.
version.h

Changed to 1.9.17alpha1.

64 files changed:
source/client/client.c
source/client/clientutil.c
source/include/byteorder.h
source/include/charset.h
source/include/includes.h
source/include/kanji.h
source/include/nameserv.h
source/include/proto.h
source/include/smb.h
source/include/trans2.h
source/include/version.h
source/lib/charcnv.c
source/lib/charset.c
source/lib/fault.c
source/lib/interface.c
source/lib/kanji.c
source/lib/replace.c
source/lib/system.c
source/lib/time.c
source/lib/username.c
source/lib/util.c
source/libsmb/namequery.c
source/libsmb/nmblib.c
source/libsmb/smbencrypt.c
source/locking/locking.c
source/locking/shmem.c
source/nameannounce.c
source/namebrowse.c
source/namedbname.c
source/namedbresp.c
source/namedbserver.c
source/namedbsubnet.c
source/namedbwork.c
source/nameelect.c
source/namelogon.c
source/namepacket.c
source/nameresp.c
source/nameserv.c
source/nameservreply.c
source/nameservresp.c
source/namework.c
source/nmbd/nmbd.c
source/nmbsync.c
source/param/loadparm.c
source/param/params.c
source/printing/printing.c
source/smbd/dir.c
source/smbd/ipc.c
source/smbd/mangle.c
source/smbd/message.c
source/smbd/password.c
source/smbd/pipes.c
source/smbd/predict.c
source/smbd/quotas.c
source/smbd/reply.c
source/smbd/server.c
source/smbd/smbrun.c
source/smbd/trans2.c
source/smbd/uid.c
source/utils/nmblookup.c
source/utils/smbpasswd.c
source/utils/status.c
source/utils/testparm.c
source/utils/testprns.c

index ac6878786af8d000be4e73a630ba0dfd79d97fc5..a9e81cfd64e29633ac35e5f024d35f8841920f62 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    SMB client
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 3058f654741ba20a2eacf1753e78a454c9d2b080..d1407332ff06ff75eb7a064054cefca9ee6eb7c1 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    SMB client
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 51f368e61b51b2196a3acf55a2aa86834571591e..a55789a40369786f07765292cc863f9048ea024c 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    SMB Byte handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 72a8810e424e6aeae508850b1b9c69a336c6bb05..5f5e2016ee1fa22750e1c054c47e8c47d73d37f8 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Character set handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 249e4940a917f0e906e8f838fcef247d5249267a..e1ed3a581683e8efff470fd202ebe7316e59b12f 100644 (file)
@@ -4,7 +4,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Machine customisation and include handling
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 6bc88b704dbeeb752feb54f912480d2513b69a23..ee3ba7e09a68c70a1cccab7ac0c03a37d4d8b97e 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Kanji Extensions
-   Copyright (C) Andrew Tridgell 1992-1994
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 42bfe83dcc3d79441ec88b5de5c9840983368953..12ddd033c8aa93835855887b6e82e4d17165e7ae 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios header - version 2
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -75,8 +75,6 @@
 #define AM_BACKUP(work) (work->ServerType & SV_TYPE_BACKUP_BROWSER)
 #define AM_DOMMST(work) (work->ServerType & SV_TYPE_DOMAIN_MASTER)
 #define AM_DOMMEM(work) (work->ServerType & SV_TYPE_DOMAIN_MEMBER)
-#define AM_ANY_MASTER(work) (check_work_servertype(work->work_group, \
-SV_TYPE_MASTER_BROWSER|SV_TYPE_DOMAIN_MASTER))
 
 /* microsoft browser NetBIOS name */
 #define MSBROWSE "\001\002__MSBROWSE__\002"
@@ -160,6 +158,8 @@ struct name_record
   time_t refresh_time; /* time record should be refreshed */
 };
 
+struct subnet_record;
+
 /* browse and backup server cache for synchronising browse list */
 struct browse_cache_record
 {
@@ -173,6 +173,7 @@ struct browse_cache_record
        time_t sync_time;
        BOOL synced;
        BOOL local;
+        struct subnet_record *subnet;
 };
 
 /* this is used to hold the list of servers in my domain, and is */
@@ -413,3 +414,15 @@ struct packet_struct
                          SV_TYPE_PRINTQ_SERVER | SV_TYPE_SERVER_NT | \
                          SV_TYPE_NT )
 
+/* Macro's to enumerate subnets either with or without
+   the WINS subnet. */
+
+extern struct subnet_record *subnetlist;
+extern struct subnet_record *wins_subnet;
+
+#define FIRST_SUBNET subnetlist
+#define NEXT_SUBNET_EXCLUDING_WINS(x) ((x)->next)
+#define NEXT_SUBNET_INCLUDING_WINS(x) ( ((x) == wins_subnet) ? 0 : \
+                                        (((x)->next == 0) ? wins_subnet : \
+                                         (x)->next))
+
index 63f562280362d584cd7649b3658b74f16425ccd3..973b1a15f39dd2b2cb3ceb1195159de58da9f202 100644 (file)
@@ -295,12 +295,14 @@ int reply_sendend(char *inbuf,char *outbuf);
 
 /*The following definitions come from  nameannounce.c  */
 
+void reset_announce_timer();
 void announce_request(struct work_record *work, struct in_addr ip);
 void do_announce_request(char *info, char *to_name, int announce_type, 
                         int from,
                         int to, struct in_addr dest_ip);
 void sync_server(enum state_type state, char *serv_name, char *work_name, 
                 int name_type,
+                 struct subnet_record *d,
                 struct in_addr ip);
 void do_announce_host(int command,
                char *from_name, int from_type, struct in_addr from_ip,
@@ -318,7 +320,9 @@ void announce_remote(time_t t);
 
 void expire_browse_cache(time_t t);
 struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
-                                             time_t ttl, struct in_addr ip, BOOL local);
+                                             time_t ttl, 
+                                              struct subnet_record *d,
+                                              struct in_addr ip, BOOL local);
 void do_browser_lists(time_t t);
 
 /*The following definitions come from  nameconf.c  */
@@ -460,7 +464,7 @@ BOOL name_query(int fd,char *name,int name_type,
 /*The following definitions come from  nameresp.c  */
 
 void expire_netbios_response_entries(time_t t);
-struct response_record *queue_netbios_pkt_wins(struct subnet_record *d,
+struct response_record *queue_netbios_pkt_wins(
                                int fd,int quest_type,enum state_type state,
                            char *name,int name_type,int nb_flags, time_t ttl,
                                int server_type, char *my_name, char *my_comment,
index fc9ac2048e5e83504ae27ee6ee8c7062b2e49597..a6be0f16d5b503fc5ed957f3a1710571e0f5b25a 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    SMB parameters and setup
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index b99f1e6028d3432cefdd83b2ada6133a26bf9274..70285358bc4cd6392f3f2a3f5b718c9fb2fc79c3 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    SMB transaction2 handling
-   Copyright (C) Jeremy Allison 1994
+   Copyright (C) Jeremy Allison 1994-1997
 
    Extensively modified by Andrew Tridgell, 1995
 
index 164110945436c093cdb506828f7fda3b0e24060a..cc69bef5216172625c58dbf0e3d64f2da640b07b 100644 (file)
@@ -1 +1 @@
-#define VERSION "1.9.16p12alpha"
+#define VERSION "1.9.17alpha1"
index 4654101a5c3f4e0cad4e22598d5fc17d75ec0c7d..cf4ae4edb62ad5e0657fb0ce08dbb53444806b76 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Character set conversion Extensions
-   Copyright (C) Andrew Tridgell 1992-1994
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 65e0cc9a3471c58fc575d36fa06a065341393a54..1c396db241da4861cd2a5e54eb91bde9afccc361 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Character set handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 9bc2eca7e02d6f6bf044071310087babddacef44..61715a4f225c030ead9155e0a9939a44d5b01d97 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Critical Fault handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 0e2a13e7b93cc38bfa6789f784bd761f41fcd89c..444d511426b91255a2fe56349347ef0f7924c95d 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    multiple interface handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index a77bdea73f0d71211161f54e4ce2b137212e9be2..479763fd406461a2041ff0581f1475febbae8e80 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Kanji Extensions
-   Copyright (C) Andrew Tridgell 1992-1994
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index c7340bbadd2246ed80bf7eae28ccc0e3a1c44931..67c18a15237b52e398ecb0076c96abc1682445cb 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    replacement routines for broken systems
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 86c4c28a593e54c857ebb20c5971db9bf8199e09..521f5e304ce94155cb414c3d2dfcad25e31b3de3 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Samba system utilities
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 215c28a2108d93c43e08140c75c64a45823b12fa..d16552b61e2d667273130ddb99444f1353ba0d11 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    time handling functions
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 07987fafb30b92e05b6dec25ce88fadb17f6b666..b8d152c83fd25da5a3e477dee6ac82f9bf385411 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Username handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 53b24173d51228e7e1e9d9e711603c81375633dc..3315f1a41a1758fcd47b8fa6dc4eb80a97d08ce7 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Samba utility functions
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index fc02add5b50bc5ee1235187191dbb701e94d0676..55f70be122282141bb300b7a6ded554cf4bd7c40 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    name query routines
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index a0f93331d95f6dce8e04e66f2e5c33271201f820..89a5cf9534bbd2f80c34b7144ef221d9d216cfb1 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios library routines
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index ee2b17ae5d1bd006fcc201947f58f8e8d373337f..8bb21cfed207ef56ebd0ee77f73dba1b36be5b93 100644 (file)
@@ -3,7 +3,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    SMB parameters and setup
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    Modified by Jeremy Allison 1995.
    
    This program is free software; you can redistribute it and/or modify
index ce96aa01cf35bb1f0d830cfcdcce15ae7c30aa8c..7c23e5b3cabdbc84a37c60c2e2ccf9ebbb3daab5 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Locking functions
-   Copyright (C) Andrew Tridgell 1992-1996
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 9f7b985e67a9ff3defc7c7f0284e653018e790f5..2c02982d04a3368414dfec434b86b50b897d574d 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Shared memory functions
-   Copyright (C) Erik Devriendt 1996
+   Copyright (C) Erik Devriendt 1996-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 8f2005a73d7a0f0740b3117ae5ace74494013246..b46436168c3996986cb5df5717d7cb14d6978a18 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ extern int  workgroup_count;
 
 extern struct in_addr wins_ip;
 
-
+extern pstring scope;
 
 /****************************************************************************
   send a announce request to the local net
@@ -119,12 +119,13 @@ void do_announce_request(char *info, char *to_name, int announce_type,
   **************************************************************************/
 void sync_server(enum state_type state, char *serv_name, char *work_name, 
                 int name_type,
+                 struct subnet_record *d,
                 struct in_addr ip)
 {                     
   /* with a domain master we can get the whole list (not local only list) */
   BOOL local_only = (state != NAME_STATUS_DOM_SRV_CHK);
 
-  add_browser_entry(serv_name, name_type, work_name, 0, ip, local_only);
+  add_browser_entry(serv_name, name_type, work_name, 0, d, ip, local_only);
 
   if (state == NAME_STATUS_DOM_SRV_CHK)
   {
@@ -189,7 +190,7 @@ void do_announce_host(int command,
 void remove_my_servers(void)
 {
        struct subnet_record *d; 
-       for (d = subnetlist; d; d = d->next)
+       for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
        {
                struct work_record *work;
                for (work = d->workgrouplist; work; work = work->next)
@@ -228,7 +229,7 @@ void announce_server(struct subnet_record *d, struct work_record *work,
                        if (!lp_wins_support() && *lp_wins_server())
                        {
                                /* look up the domain master with the WINS server */
-                               queue_netbios_pkt_wins(d,ClientNMB,NMB_QUERY,
+                               queue_netbios_pkt_wins(ClientNMB,NMB_QUERY,
                                         NAME_QUERY_ANNOUNCE_HOST,
                                         work->work_group,0x1b,0,ttl*1000,
                                         server_type,name,comment,
@@ -305,12 +306,10 @@ void announce_host(time_t t)
 
   my_name = *myname ? myname : "NoName";
 
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
     {
       struct work_record *work;
       
-      if (ip_equal(d->bcast_ip, wins_ip)) continue;
-      
       for (work = d->workgrouplist; work; work = work->next)
        {
          uint32 stype = work->ServerType;
@@ -362,6 +361,19 @@ void announce_host(time_t t)
     }
 }
 
+/* Announce timer. Moved into global static so it can be reset
+   when a machine becomes a master browser. */
+static time_t announce_timer_last=0;
+
+/****************************************************************************
+ Reset the announce_timer so that a master browser announce will be done
+ immediately.
+ ****************************************************************************/
+
+void reset_announce_timer()
+{
+  announce_timer_last = 0;
+}
 
 /****************************************************************************
   announce myself as a master to all other domain master browsers.
@@ -373,16 +385,26 @@ void announce_host(time_t t)
 void announce_master(time_t t)
 {
   struct subnet_record *d;
-  static time_t last=0;
+  struct work_record *work;
   BOOL am_master = False; /* are we a master of some sort? :-) */
 
-  if (!last) last = t;
-  if (t-last < CHECK_TIME_MST_ANNOUNCE * 60)
-       return;
+  if (!announce_timer_last) announce_timer_last = t;
+  if (t-announce_timer_last < CHECK_TIME_MST_ANNOUNCE * 60)
+    {
+      DEBUG(10,("announce_master: t (%d) - last(%d) < %d\n",
+                 t, announce_timer_last, CHECK_TIME_MST_ANNOUNCE * 60 ));
+      return;
+    }
+
+  if(wins_subnet == 0)
+    {
+      DEBUG(10,("announce_master: no wins subnet, ignoring.\n"));
+      return;
+    }
 
-  last = t;
+  announce_timer_last = t;
 
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
     {
       struct work_record *work;
       for (work = d->workgrouplist; work; work = work->next)
@@ -398,69 +420,95 @@ void announce_master(time_t t)
 
   if (!am_master) return; /* only proceed if we are a master browser */
   
-  /* Note that we don't do this if we are domain master browser. */
+  /* Note that we don't do this if we are domain master browser
+     and that we *only* do this on the WINS subnet. */
+
+  /* Try and find our workgroup on the WINS subnet */
+  work = find_workgroupstruct(wins_subnet, lp_workgroup(), False);
 
-  for (d = subnetlist; d; d = d->next)
+  if (work)
     {
-      /* Try and find our workgroup on this subnet */
-      struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False);
+      char *name;
+      int   type;
 
-      if (work)
+      if (*lp_domain_controller())
         {
-          char *name;
-          int   type;
-
-          if (*lp_domain_controller())
-            {
-              /* the domain controller option is used to manually specify
-                 the domain master browser to sync with
-               */
-
-              /* XXXX i'm not sure we should be using the domain controller
-                 option for this purpose.
-               */
-
-              name = lp_domain_controller();
-              type = 0x20;
-            }
-          else
-            {
-              /* assume that the domain master browser we want to sync
-                 with is our own domain.
-               */
-              name = work->work_group;
-              type = 0x1b;
-            }
-
-          /* check the existence of a dmb for this workgroup, and if
-             one exists at the specified ip, sync with it and announce
-             ourselves as a master browser to it
+          /* the domain controller option is used to manually specify
+             the domain master browser to sync with
            */
 
-          if (!lp_wins_support() && *lp_wins_server() &&
-               ip_equal(d->bcast_ip, wins_ip))
-            {
-              DEBUG(4, ("Local Announce: find %s<%02x> from WINS server %s\n",
-                         name, type, lp_wins_server()));
-
-              queue_netbios_pkt_wins(d,ClientNMB,
-                        NMB_QUERY,NAME_QUERY_DOM_SRV_CHK,
-                        name, type, 0,0,0,
-                        work->work_group,NULL,
-                        False, False, ipzero, ipzero);
-            }
-          else
-            {
-              DEBUG(4, ("Local Announce: find %s<%02x> on %s\n",
-                name, type, inet_ntoa(d->bcast_ip)));
-
-              queue_netbios_packet(d,ClientNMB,
-                         NMB_QUERY,NAME_QUERY_DOM_SRV_CHK,
-                         name, type, 0,0,0,
-                         work->work_group,NULL,
-                         True, False, d->bcast_ip, d->bcast_ip);
-           }
-       }
+          /* XXXX i'm not sure we should be using the domain controller
+             option for this purpose.
+           */
+
+          name = lp_domain_controller();
+          type = 0x20;
+        }
+      else
+        {
+          /* assume that the domain master browser we want to sync
+             with is our own domain.
+           */
+          name = work->work_group;
+          type = 0x1b;
+        }
+
+      /* check the existence of a dmb for this workgroup, and if
+         one exists at the specified ip, sync with it and announce
+         ourselves as a master browser to it
+       */
+
+      if (!lp_wins_support() && *lp_wins_server() )
+        {
+          DEBUG(4, ("Local Announce: find %s<%02x> from WINS server %s\n",
+                     name, type, lp_wins_server()));
+
+          queue_netbios_pkt_wins(ClientNMB,
+                    NMB_QUERY,NAME_QUERY_DOM_SRV_CHK,
+                    name, type, 0,0,0,
+                    work->work_group,NULL,
+                    False, False, ipzero, ipzero);
+        }
+      else if(lp_wins_support()) 
+        {
+           /* We are the WINS server - query ourselves for the dmb name. */
+
+           struct nmb_name netb_name;
+           struct subnet_record *d = 0;
+           struct name_record *nr = 0;
+           make_nmb_name(&netb_name, name, type, scope);
+
+           if ((nr = find_name_search(&d, &netb_name, FIND_WINS, ipzero)) == 0)
+             {
+               DEBUG(0, ("announce_master: unable to find domain master browser for workgroup %s \
+in our own WINS database.\n", work->work_group));
+               return;
+             }
+
+           /* Check that this isn't one of our addresses (ie. we are not domain master
+              ourselves) */
+           if(ismyip(nr->ip_flgs[0].ip))
+             {
+               DEBUG(4, ("announce_master: domain master ip found (%s) for workgroup %s \
+is one of our interfaces.\n", work->work_group, inet_ntoa(nr->ip_flgs[0].ip) ));
+               return;
+             }
+
+           /* Issue a NAME_STATUS_DOM_SRV_CHK immediately - short circuit the
+              NAME_QUERY_DOM_SRV_CHK which is done only if we are talking to a 
+              remote WINS server. */
+
+           DEBUG(4, ("announce_master: doing name status for %s<%02x> to domain master ip %s \
+for workgroup %s\n", name, type, inet_ntoa(nr->ip_flgs[0].ip), work->work_group ));
+
+           queue_netbios_packet(wins_subnet, ClientNMB,
+                    NMB_QUERY,NAME_STATUS_DOM_SRV_CHK,
+                    name, type, 0,0,0,
+                    work->work_group,NULL,
+                    False, False, nr->ip_flgs[0].ip, nr->ip_flgs[0].ip);
+         }
+
     }
 }
 
index b891f51718e4a3a9974eeb8c1d1cf701f52c8c1d..1dd293d27be0ae31fea4e30604bb9d083563059a 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -95,7 +95,8 @@ void expire_browse_cache(time_t t)
   add a browser entry
   ****************************************************************************/
 struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
-                                             time_t ttl, struct in_addr ip, BOOL local)
+                                             time_t ttl, struct subnet_record *d,
+                                              struct in_addr ip, BOOL local)
 {
   BOOL newentry=False;
   
@@ -137,7 +138,8 @@ struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
   b->ip     = ip;
   b->type   = type;
   b->local  = local; /* local server list sync or complete sync required */
-  
+  b->subnet = d;
   if (newentry || ttl < b->sync_time) 
     b->sync_time = ttl;
   
@@ -164,20 +166,14 @@ find a server responsible for a workgroup, and sync browse lists
 **************************************************************************/
 static void start_sync_browse_entry(struct browse_cache_record *b)
 {                     
-  struct subnet_record *d;
+  struct subnet_record *d = b->subnet;
   struct work_record *work;
 
-  /* Look for the workgroup first on the local subnet. If this
-     fails try WINS - we may need to sync with the domain master,
-     or we may be the domain master and need to sync with subnet
-     masters.
-  */
-
-  if (!(d = find_subnet_all(b->ip))) {
-    DEBUG(0, ("start_sync_browse_entry: failed to get a \
-subnet for a browse cache entry workgroup %s, server %s\n", 
-                  b->group, b->name));
-    return;
+  /* Check panic conditions - these should not be true. */
+  if(b->subnet != wins_subnet) {
+      DEBUG(0, 
+        ("start_sync_browse_entry: ERROR sync requested on non-WINS subnet.\n"));
+      return;
   }
 
   if (!(work = find_workgroupstruct(d, b->group, False))) {
@@ -187,29 +183,23 @@ workgroup for a browse cache entry workgroup %s, server %s\n",
       return;
   }
 
-  /* only sync if we are a subnet master or domain master - but
-     we sync if we are a master for this workgroup on *any* 
-     of our interfaces. */
-  if (AM_MASTER(work) || AM_DOMMST(work) || AM_ANY_MASTER(work)) {
-
-    DEBUG(4, ("start_sync_browse_entry: Initiating %s sync with %s<0x20>, \
+  DEBUG(4, ("start_sync_browse_entry: Initiating %s sync with %s<0x20>, \
 workgroup %s\n",
-               b->local ? "local" : "remote", b->name, b->group));
+             b->local ? "local" : "remote", b->name, b->group));
 
-    /* first check whether the server we intend to sync with exists. if it
-       doesn't, the server must have died. o dear. */
+  /* first check whether the server we intend to sync with exists. if it
+     doesn't, the server must have died. o dear. */
 
-    /* see response_netbios_packet() or expire_netbios_response_entries() */
-    /* We cheat here by using the my_comment field of the response_record 
-       struct as the workgroup name we are going to do the sync for. 
-       This is because the reply packet doesn't include the workgroup, but 
-       we need it when the reply comes back.
-    */
-    queue_netbios_packet(d,ClientNMB,NMB_QUERY,
-                        b->local?NAME_QUERY_SYNC_LOCAL:NAME_QUERY_SYNC_REMOTE,
-                        b->name,0x20,0,0,0,NULL,b->group,
-                        False,False,b->ip,b->ip);
-  }
+  /* see response_netbios_packet() or expire_netbios_response_entries() */
+  /* We cheat here by using the my_comment field of the response_record 
+     struct as the workgroup name we are going to do the sync for. 
+     This is because the reply packet doesn't include the workgroup, but 
+     we need it when the reply comes back.
+  */
+  queue_netbios_packet(d,ClientNMB,NMB_QUERY,
+        b->local?NAME_QUERY_SYNC_LOCAL:NAME_QUERY_SYNC_REMOTE,
+        b->name,0x20,0,0,0,NULL,b->group,
+        False,False,b->ip,b->ip);
 
   b->synced = True;
 }
index d27bcf81586f566c89fe6c19406500b5b84dbf6b..5c514c263ffe1248d06ce4afe1c72d69216467b9 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -187,7 +187,7 @@ struct name_record *find_name_search(struct subnet_record **d,
   if (!(search & FIND_WINS)) return NULL;
 
   /* find WINS subnet record. */
-  *d = find_subnet(wins_ip);
+  *d = wins_subnet;
   
   if (*d == NULL) return NULL;
   
@@ -203,12 +203,14 @@ struct name_record *find_name_search(struct subnet_record **d,
 void dump_names(void)
 {
   struct name_record *n;
-  struct subnet_record *d;
   fstring fname, fnamenew;
   time_t t = time(NULL);
   
   FILE *f;
-  
+  if(lp_wins_support() == False || wins_subnet == 0)
+    return;
   strcpy(fname,lp_lockdir());
   trim_string(fname,NULL,"/");
   strcat(fname,"/");
@@ -224,29 +226,28 @@ void dump_names(void)
     return;
   }
   
-  DEBUG(4,("Dump of local name table:\n"));
+  DEBUG(4,("Dump of WINS name table:\n"));
   
-  for (d = subnetlist; d; d = d->next)
-   for (n = d->namelist; n; n = n->next)
-    {
-      int i;
+  for (n = wins_subnet->namelist; n; n = n->next)
+   {
+     int i;
 
-         DEBUG(4,("%15s ", inet_ntoa(d->bcast_ip)));
-         DEBUG(4,("%15s ", inet_ntoa(d->mask_ip)));
-      DEBUG(4,("%-19s TTL=%ld ",
+     DEBUG(4,("%15s ", inet_ntoa(wins_subnet->bcast_ip)));
+     DEBUG(4,("%15s ", inet_ntoa(wins_subnet->mask_ip)));
+     DEBUG(4,("%-19s TTL=%ld ",
               namestr(&n->name),
               n->death_time?n->death_time-t:0));
 
-        for (i = 0; i < n->num_ips; i++)
-        {
-           DEBUG(4,("%15s NB=%2x source=%d",
-                   inet_ntoa(n->ip_flgs[i].ip),
+     for (i = 0; i < n->num_ips; i++)
+      {
+        DEBUG(4,("%15s NB=%2x source=%d",
+                 inet_ntoa(n->ip_flgs[i].ip),
                    n->ip_flgs[i].nb_flags,n->source));
 
-        }
-               DEBUG(4,("\n"));
+      }
+     DEBUG(4,("\n"));
 
-      if (f && ip_equal(d->bcast_ip, wins_ip) && n->source == REGISTER)
+     if (f && n->source == REGISTER)
       {
       /* XXXX i have little imagination as to how to output nb_flags as
          anything other than as a hexadecimal number :-) */
@@ -264,7 +265,7 @@ void dump_names(void)
                fprintf(f, "\n");
       }
 
-    }
+  }
 
   fclose(f);
   unlink(fname);
@@ -282,7 +283,7 @@ void dump_names(void)
   ****************************************************************************/
 void load_netbios_names(void)
 {
-  struct subnet_record *d = find_subnet(wins_ip);
+  struct subnet_record *d = wins_subnet;
   fstring fname;
 
   FILE *f;
@@ -414,6 +415,7 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
 {
   struct name_record *n;
   struct name_record *n2=NULL;
+  struct subnet_record *found_subnet = 0;
   int search = 0;
   BOOL self = source == SELF;
 
@@ -447,12 +449,13 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
 
   make_nmb_name(&n->name,name,type,scope);
 
-  if ((n2 = find_name_search(&d, &n->name, search, new_only?ipzero:ip)))
+  if ((n2 = find_name_search(&found_subnet, &n->name, search, new_only?ipzero:ip)))
   {
     free(n->ip_flgs);
     free(n);
     if (new_only || (n2->source==SELF && source!=SELF)) return n2;
     n = n2;
+    d = found_subnet;
   }
 
   if (ttl)
@@ -469,7 +472,7 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
 
   DEBUG(3,("Added netbios name %s at %s ttl=%d nb_flags=%2x to interface %s\n",
           namestr(&n->name),inet_ntoa(ip),ttl,nb_flags,
-          ip_equal(d->bcast_ip, wins_ip) ? "WINS" : inet_ntoa(d->bcast_ip)));
+          ip_equal(d->bcast_ip, wins_ip) ? "WINS" : (char *)inet_ntoa(d->bcast_ip)));
 
   return(n);
 }
@@ -485,7 +488,7 @@ void expire_names(time_t t)
        struct subnet_record *d;
 
        /* expire old names */
-       for (d = subnetlist; d; d = d->next)
+       for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
        {
          for (n = d->namelist; n; n = next)
            {
@@ -522,9 +525,9 @@ struct name_record *dns_name_search(struct nmb_name *question, int Time)
        char *r;
        BOOL dns_type = (name_type == 0x20 || name_type == 0);
        struct in_addr dns_ip;
-       struct subnet_record *d = find_subnet(wins_ip);
 
-       if (d == NULL) return NULL;
+       if (wins_subnet == NULL) 
+          return NULL;
 
        DEBUG(3,("Search for %s - ", namestr(question)));
 
@@ -543,7 +546,7 @@ struct name_record *dns_name_search(struct nmb_name *question, int Time)
                /* no luck with DNS. We could possibly recurse here XXXX */
                DEBUG(3,("not found. no recursion.\n"));
                /* add the fail to WINS cache of names. give it 1 hour in the cache */
-               add_netbios_entry(d,qname,name_type,NB_ACTIVE,60*60,DNSFAIL,dns_ip,
+               add_netbios_entry(wins_subnet,qname,name_type,NB_ACTIVE,60*60,DNSFAIL,dns_ip,
                                  True, True);
                return NULL;
        }
@@ -551,6 +554,6 @@ struct name_record *dns_name_search(struct nmb_name *question, int Time)
        DEBUG(3,("found with DNS: %s\n", inet_ntoa(dns_ip)));
 
        /* add it to our WINS cache of names. give it 2 hours in the cache */
-       return add_netbios_entry(d,qname,name_type,NB_ACTIVE,2*60*60,DNS,dns_ip,
+       return add_netbios_entry(wins_subnet,qname,name_type,NB_ACTIVE,2*60*60,DNS,dns_ip,
                                 True,True);
 }
index 6755de6534b620cb4a1bc3e3adda49a098edc649..98f8ca774bc553ebebb42cf6a5526a7dd760eeba 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios library routines
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -144,7 +144,7 @@ struct response_record *find_response_record(struct subnet_record **d,
 
   if (!d) return NULL;
 
-  for ((*d) = subnetlist; (*d); (*d) = (*d)->next)
+  for ((*d) = FIRST_SUBNET; (*d); (*d) = NEXT_SUBNET_INCLUDING_WINS(*d))
   {
     for (n = (*d)->responselist; n; n = n->next)
     {
index afb1dc1431550d80503ad30b37d2934b16622e59..9c7bb664ab23fda93c7e25ad36b50c717f6209ca 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -208,7 +208,7 @@ void expire_servers(time_t t)
 {
   struct subnet_record *d;
   
-  for (d = subnetlist ; d ; d = d->next)
+  for (d = FIRST_SUBNET; d ; d = NEXT_SUBNET_INCLUDING_WINS(d))
     {
       struct work_record *work;
       
index 144729e1e17dc3eb98cbeca528cb5d1f102cf4ef..25c369ab1c8800eb513db1f11e25ae1ffad72812 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -50,6 +50,10 @@ extern struct interface *local_interfaces;
 /* this is our domain/workgroup/server database */
 struct subnet_record *subnetlist = NULL;
 
+/* WINS subnet - keep this separate so enumeration code doesn't
+   run onto it by mistake. */
+struct subnet_record *wins_subnet = 0;
+
 extern uint16 nb_type; /* samba's NetBIOS name type */
 
 /* Forward references. */
@@ -81,32 +85,19 @@ static void add_subnet(struct subnet_record *d)
 
 
 /****************************************************************************
-  find a subnet in the subnetlist 
+  find a subnet in the subnetlist - not including WINS.
   **************************************************************************/
 struct subnet_record *find_subnet(struct in_addr bcast_ip)
 {   
   struct subnet_record *d;
   
   /* search through subnet list for broadcast/netmask that matches
-     the source ip address. a subnet 255.255.255.255 represents the
-     WINS list. */
+     the source ip address. */
   
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
     {
-      if (ip_equal(bcast_ip, wins_ip))
-       {
-         if (ip_equal(bcast_ip, d->bcast_ip))
-           {
-             return d;
-           }
-        }
-      else if (same_net(bcast_ip, d->bcast_ip, d->mask_ip))
-       {
-         if (!ip_equal(d->bcast_ip, wins_ip))
-           {
-             return d;
-           }
-       }
+      if (same_net(bcast_ip, d->bcast_ip, d->mask_ip))
+        return d;
     }
   
   return (NULL);
@@ -125,8 +116,8 @@ struct subnet_record *find_req_subnet(struct in_addr ip, BOOL bcast)
     /* identify the subnet the broadcast request came from */
     return find_subnet(*iface_bcast(ip));
   }
-  /* find the subnet under the pseudo-ip of 255.255.255.255 */
-  return find_subnet(wins_ip);
+  /* Return the subnet with the pseudo-ip of 255.255.255.255 */
+  return wins_subnet;
 }
 
 /****************************************************************************
@@ -137,13 +128,13 @@ struct subnet_record *find_subnet_all(struct in_addr bcast_ip)
 {
   struct subnet_record *d = find_subnet(bcast_ip);
   if(!d)
-    return find_subnet( wins_ip);
+    return wins_subnet;
 }
 
 /****************************************************************************
   create a domain entry
   ****************************************************************************/
-static struct subnet_record *make_subnet(struct in_addr bcast_ip, struct in_addr mask_ip)
+static struct subnet_record *make_subnet(struct in_addr bcast_ip, struct in_addr mask_ip, BOOL add)
 {
   struct subnet_record *d;
   d = (struct subnet_record *)malloc(sizeof(*d));
@@ -159,7 +150,8 @@ static struct subnet_record *make_subnet(struct in_addr bcast_ip, struct in_addr
   d->mask_ip  = mask_ip;
   d->workgrouplist = NULL;
   
-  add_subnet(d);
+  if(add)
+    add_subnet(d);
   
   return d;
 }
@@ -179,7 +171,7 @@ void add_subnet_interfaces(void)
       /* add the interface into our subnet database */
       if (!find_subnet(i->bcast))
        {
-         make_subnet(i->bcast,i->nmask);
+         make_subnet(i->bcast,i->nmask, True);
        }
     }
 
@@ -188,14 +180,14 @@ void add_subnet_interfaces(void)
     {
       struct in_addr wins_bcast = wins_ip;
       struct in_addr wins_nmask = ipzero;
-      make_subnet(wins_bcast, wins_nmask);
+      wins_subnet = make_subnet(wins_bcast, wins_nmask, False);
     }
 }
 
 
 
 /****************************************************************************
-  add the default workgroup into my domain
+  add the default workgroup into the subnet lists.
   **************************************************************************/
 void add_my_subnets(char *group)
 {
@@ -212,6 +204,18 @@ void add_my_subnets(char *group)
     {
       add_subnet_entry(i->bcast,i->nmask,group, True, False);
     }
+
+    /* If we are setup as a domain master browser, and are using
+       WINS, then we must add the workgroup to the WINS subnet. This
+       is used as a place to keep collated server lists. */
+
+    if(lp_domain_master() && (lp_wins_support() || lp_wins_server()))
+      if(find_workgroupstruct(wins_subnet, group, True) == 0)
+        DEBUG(0, ("add_my_subnets: Failed to add workgroup %s to \
+WINS subnet.\n", group));
+      else
+        DEBUG(3,("add_my_subnets: Added workgroup %s to WINS subnet.\n",
+                 group));
 }
 
 
@@ -240,7 +244,7 @@ static struct subnet_record *add_subnet_entry(struct in_addr bcast_ip,
   /* Note that we never add into the WINS subnet as add_subnet_entry
      is only called to add our local interfaces. */
   if ((d = find_subnet(bcast_ip)) ||
-      (d = make_subnet(bcast_ip, mask_ip)))
+      (d = make_subnet(bcast_ip, mask_ip, True)))
     {
       struct work_record *w = find_workgroupstruct(d, name, add);
       
@@ -304,7 +308,7 @@ void write_browse_list(time_t t)
       return;
     }
   
-  for (d = subnetlist; d ; d = d->next)
+  for (d = FIRST_SUBNET; d ; d = NEXT_SUBNET_INCLUDING_WINS(d))
     {
       struct work_record *work;
       for (work = d->workgrouplist; work ; work = work->next)
index 80a670fea84e8d36d4f8ea034144c20bf25782fb..8c249cc82cbac20b825a4ffb9e32b9761be01eb8 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -97,7 +97,7 @@ static struct work_record *make_workgroup(char *name)
   
   /* make sure all token representations of workgroups are unique */
   
-  for (d = subnetlist; d && t == -1; d = d->next)
+  for (d = FIRST_SUBNET; d && t == -1; d = NEXT_SUBNET_INCLUDING_WINS(d))
     {
       struct work_record *w;
       for (w = d->workgrouplist; w && t == -1; w = w->next)
@@ -175,16 +175,6 @@ struct work_record *find_workgroupstruct(struct subnet_record *d,
   
   DEBUG(4, ("workgroup search for %s: ", name));
   
-  if (strequal(name, "*"))
-    {
-      DEBUG(2,("add any workgroups: initiating browser search on %s\n",
-              inet_ntoa(d->bcast_ip)));
-      queue_netbios_pkt_wins(d,ClientNMB,NMB_QUERY, NAME_QUERY_FIND_MST,
-                            MSBROWSE,0x1,0,0,0,NULL,NULL,
-                            True,False, d->bcast_ip, d->bcast_ip);
-      return NULL;
-    }
-  
   for (ret = d->workgrouplist; ret; ret = ret->next) {
     if (!strcmp(ret->work_group,name)) {
       DEBUG(4, ("found\n"));
@@ -223,7 +213,7 @@ void dump_workgroups(void)
 {
   struct subnet_record *d;
   
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
     {
       if (d->workgrouplist)
        {
@@ -248,42 +238,3 @@ void dump_workgroups(void)
        }
     }
 }
-
-/****************************************************************************
-  check to see if a ServerType bit is set in any workgroup on any interface
-  except WINS. Used to determine if a nmbd is a master browser or domain 
-  master browser in a particular workgroup on any subnet.
-  **************************************************************************/
-int check_work_servertype(const char *work_name, int type_mask)
-{
-  struct subnet_record *d;
-
-  for (d = subnetlist; d; d = d->next)
-    {
-      if(ip_equal(d->bcast_ip, wins_ip)) 
-        {
-          /* WINS ip */
-          DEBUG(10,("check_work_servertype: ignoring WINS subnet\n"));
-          continue;
-        }
-      if (d->workgrouplist)
-        {
-          struct work_record *work;
-
-          for (work = d->workgrouplist; work; work = work->next)
-            {
-              if(strequal(work->work_group, (char *)work_name) &&
-                    (type_mask & work->ServerType) != 0)
-                {
-                  DEBUG(10, ("check_work_servertype: Workgroup %s has \
-ServerType %x - match for type_mask %x\n", work_name, work->ServerType,
-                       type_mask));
-                  return 1;
-                }
-            }
-         }
-    }
-  DEBUG(10, ("check_work_servertype: Workgroup %s has no match for \
-type mask %x\n", work_name, type_mask));
-  return 0;
-}                
index 4aacee55d419a5bdd1a6d0a4e19e216e8454d260..02fda9f817ba84d8db67af1565ac39954c1761d1 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -67,14 +67,10 @@ void check_master_browser(time_t t)
 
        dump_workgroups();
 
-       for (d = subnetlist; d; d = d->next)
+       for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
        {
                struct work_record *work;
 
-                /* don't do election stuff on the WINS subnet */
-               if (ip_equal(d->bcast_ip,wins_ip)) 
-                  continue;
-
                for (work = d->workgrouplist; work; work = work->next)
                {
                        if (strequal(work->work_group, lp_workgroup()) && !AM_MASTER(work))
@@ -365,7 +361,27 @@ void become_local_master(struct subnet_record *d, struct work_record *work)
         /* XXXX OOPS! add_server_entry will always add one entry - our own. */
         announce_request(work, d->bcast_ip);
       }
+
+      /* If we have WINS support or are a WINS server we must add
+         the workgroup we just became master browser for to the 
+         WINS subnet. This is needed so we have somewhere to save
+         server lists when we do browser synchronization. */
+      if(wins_subnet != 0) 
+        {
+          if(find_workgroupstruct(wins_subnet, work->work_group, True) == 0)
+            DEBUG(0, ("become_local_master: \
+Failed to add workgroup %s to WINS subnet.\n",
+                     work->work_group));
+          else
+            DEBUG(3, ("become_local_master: Added workgroup %s to WINS subnet.\n",
+                   work->work_group));
+
+          /* Reset the announce master timer so that we do an announce as soon as possible
+             now we are a master. */
+          reset_announce_timer();
+        }
       break;
+
     }
 
     case MST_BROWSER:
@@ -642,17 +658,10 @@ void run_elections(time_t t)
   
   lastime = t;
   
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
   {
     struct work_record *work;
 
-    if(ip_equal(d->bcast_ip, wins_ip)) 
-      {
-        /* WINS ip */
-        DEBUG(10,("run_elections: ignoring WINS subnet\n"));
-        continue;
-      }
-
     for (work = d->workgrouplist; work; work = work->next)
        {
          if (work->RunningElection)
@@ -777,7 +786,7 @@ BOOL check_elections(void)
   struct subnet_record *d;
   BOOL run_any_election = False;
 
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
     {
       struct work_record *work;
       for (work = d->workgrouplist; work; work = work->next)
index f3afd4273cb0e0cd6f2c40b015173a2dcd7aec88..1c118c854184251361391acaa8d4ab3776117b36 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 09ee5dd79e2476eb9daf2ad7d044c32aa7673ffa..c9db43dcc5fbd601ca2ae698775b9ab6f2688c4c 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index fab16038ce0f1c5c1540f9f44be7b5466df7e365..3128b00ac58c45a1f38239b83207eff1383d1bfc 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios library routines
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ static void dead_netbios_entry(struct subnet_record *d,
          
          if ((!NAME_GROUP(n->nb_flags)))
            {
-             struct subnet_record *d1 = find_subnet(wins_ip);
+             struct subnet_record *d1 = wins_subnet;
              if (d1)
                {
                  /* remove the name that had been registered with us,
@@ -162,18 +162,11 @@ static void dead_netbios_entry(struct subnet_record *d,
   
   case NAME_QUERY_DOMAIN:
     {
-      /* if no response received, there is no domain controller on
-         this local subnet.  it's ok for us to register
+      /* if no response was received, there is no domain controller for
+         this DOMAIN registered within WINS.  it's ok for us to register
+         the DOMAIN<1b> name.
         */
       
-      if (!n->bcast)
-       {
-         DEBUG(0,("NAME_QUERY_DOMAIN incorrectly used - contact samba-bugs!\n"));
-         /* XXXX whoops. someone's using this to unicast a packet.  this state
-            should only be used for broadcast checks
-            */
-         break;
-       }
       if (n->num_msgs == 0)
        {
          struct work_record *work = find_workgroupstruct(d,n->name.name,False);
@@ -182,6 +175,11 @@ static void dead_netbios_entry(struct subnet_record *d,
              become_domain_master(d,work);
            }
        }
+      else
+        {
+          DEBUG(0, ("ERROR: nmbd configured as domain master and one already exitsts !!!\n"));
+          exit(1);
+        }
       break;
     }
 
@@ -206,7 +204,7 @@ void expire_netbios_response_entries(time_t t)
 {
   struct subnet_record *d;
 
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
   {
     struct response_record *n, *nextn;
 
@@ -249,7 +247,7 @@ void expire_netbios_response_entries(time_t t)
   name server instead, if it exists. if wins is false, and there has been no
   WINS server specified, the packet will NOT be sent.
   ****************************************************************************/
-struct response_record *queue_netbios_pkt_wins(struct subnet_record *d,
+struct response_record *queue_netbios_pkt_wins(
                                int fd,int quest_type,enum state_type state,
                            char *name,int name_type,int nb_flags, time_t ttl,
                                int server_type, char *my_name, char *my_comment,
@@ -283,7 +281,7 @@ struct response_record *queue_netbios_pkt_wins(struct subnet_record *d,
 
   if (zero_ip(send_ip)) return NULL;
 
-  return queue_netbios_packet(d,fd, quest_type, state, 
+  return queue_netbios_packet(wins_subnet,fd, quest_type, state, 
                       name, name_type, nb_flags, ttl,
                server_type,my_name,my_comment,
                       bcast, recurse, send_ip, reply_to_ip);
index ac2dac1683c8df01cb4d76d497d19d464c25963e..022b5521a21dac20bb6461a9ee25d6ed6551797c 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -85,7 +85,7 @@ void remove_name_entry(struct subnet_record *d, char *name,int type)
     if (!lp_wins_support())
     {
       /* not a WINS server: we have to release them on the network */
-      queue_netbios_pkt_wins(d,ClientNMB,NMB_REL,NAME_RELEASE,
+      queue_netbios_pkt_wins(ClientNMB,NMB_REL,NAME_RELEASE,
                             name, type, 0, 0,0,NULL,NULL,
                             False, True, ipzero, ipzero);
     }
@@ -142,7 +142,7 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags)
     else
     {
       /* a time-to-live allows us to refresh this name with the WINS server. */
-         queue_netbios_pkt_wins(d,ClientNMB,
+         queue_netbios_pkt_wins(ClientNMB,
                                 re_reg ? NMB_REG_REFRESH : NMB_REG, NAME_REGISTER,
                             name, type, nb_flags, GET_TTL(0),0,NULL,NULL,
                             False, True, ipzero, ipzero);
@@ -171,15 +171,15 @@ void add_domain_names(time_t t)
 {
   static time_t lastrun = 0;
   struct subnet_record *d;
+  struct work_record *work;
+  struct nmb_name n;
 
   if (lastrun != 0 && t < lastrun + CHECK_TIME_ADD_DOM_NAMES * 60) return;
   lastrun = t;
 
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
   {
-    struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False);
-    struct nmb_name n;
-
+    work = find_workgroupstruct(d, lp_workgroup(), False);
     if (lp_domain_logons() && work && work->log_state == LOGON_NONE)
     {
       make_nmb_name(&n,lp_workgroup(),0x1c,scope);
@@ -191,52 +191,52 @@ void add_domain_names(time_t t)
         become_logon_server(d, work);
       }
     }
+  }
 
-    if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE)
+  if(wins_subnet != 0)
+    work = find_workgroupstruct(wins_subnet, lp_workgroup(), False);
+
+  if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE)
     {
 
       DEBUG(0,("add_domain_names:Checking for domain master on workgroup %s\n", lp_workgroup()));
 
       make_nmb_name(&n,lp_workgroup(),0x1b,scope);
-      if (!find_name(d->namelist, &n, FIND_SELF))
+      if (!find_name(wins_subnet->namelist, &n, FIND_SELF))
       {
-        DEBUG(0,("add_domain_names: attempting to become domain master browser on workgroup %s, bcast %s\n",
-                  lp_workgroup(), inet_ntoa(d->bcast_ip)));
+        DEBUG(0,("add_domain_names: attempting to become domain master browser on workgroup %s\n",
+                  lp_workgroup()));
 
-        if (ip_equal(d->bcast_ip,wins_ip))
+        if (lp_wins_support())
         {
-          if (lp_wins_support())
-          {
-            /* use the wins server's capabilities (indirectly).  if
-               someone has already register the domain<1b> name with 
-               the WINS server, then the WINS server's job is to _check_
-               that the owner still wants it, before giving it away.
-             */
+          /* use the wins server's capabilities (indirectly).  if
+             someone has already registered the domain<1b> name with 
+             the WINS server, then the WINS server's job is to _check_
+             that the owner still wants it, before giving it away.
+           */
                
-            DEBUG(1,("%s initiating becoming logon server for %s %s\n",
-                       timestring(), lp_workgroup(), inet_ntoa(d->bcast_ip)));
-            become_domain_master(d, work);
-          }
+          DEBUG(1,("%s initiating becoming domain master for %s\n",
+                       timestring(), lp_workgroup()));
+          become_domain_master(wins_subnet, work);
         }
         else
         {
           /* send out a query to establish whether there's a 
-             domain controller on the local subnet.  if not,
-             we can become a domain controller on that subnet.
+             domain controller on the WINS subnet.  if not,
+             we can become a domain controller.
              it's only polite that we check, before claiming the
              NetBIOS name 0x1b.
            */
 
-          DEBUG(0,("add_domain_names:querying for domain master on workgroup %s\n", lp_workgroup()));
+          DEBUG(0,("add_domain_names:querying WINS for domain master on workgroup %s\n", lp_workgroup()));
 
-          queue_netbios_packet(d,ClientNMB,NMB_QUERY,NAME_QUERY_DOMAIN,
+          queue_netbios_pkt_wins(ClientNMB,NMB_QUERY,NAME_QUERY_DOMAIN,
                                lp_workgroup(), 0x1b,
                                0, 0,0,NULL,NULL,
-                               True, True, d->bcast_ip, d->bcast_ip);
+                               False, False, ipzero, ipzero);
         }
       }
     }
-  }
 }
 
 
@@ -252,9 +252,9 @@ void add_my_names(void)
      there would be yet _another_ for-loop, this time on the transport type
    */
 
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
   {
-    BOOL wins = lp_wins_support() && ip_equal(d->bcast_ip,wins_ip);
+    BOOL wins = (lp_wins_support() && (d == wins_subnet));
     struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False);
 
     add_my_name_entry(d, myname,0x20,nb_type|NB_ACTIVE);
@@ -268,15 +268,6 @@ void add_my_names(void)
     add_netbios_entry(d,"*",0x20,nb_type|NB_ACTIVE,0,SELF,d->myip,False,wins);
     add_netbios_entry(d,"__SAMBA__",0x20,nb_type|NB_ACTIVE,0,SELF,d->myip,False,wins);
     add_netbios_entry(d,"__SAMBA__",0x00,nb_type|NB_ACTIVE,0,SELF,d->myip,False,wins);
-    
-    if (lp_domain_logons() && work && work->log_state == LOGON_NONE)
-    {
-      become_logon_server(d, work);
-    }
-    if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE)
-    {
-      become_domain_master(d, work);
-    }
   }
 }
 
@@ -288,7 +279,7 @@ void remove_my_names()
 {
        struct subnet_record *d;
 
-       for (d = subnetlist; d; d = d->next)
+       for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
        {
                struct name_record *n, *next;
 
@@ -314,7 +305,7 @@ void refresh_my_names(time_t t)
 {
   struct subnet_record *d;
 
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
   {
     struct name_record *n;
          
@@ -347,7 +338,7 @@ void refresh_my_names(time_t t)
 void query_refresh_names(time_t t)
 {
        struct name_record *n;
-       struct subnet_record *d = find_subnet(wins_ip);
+       struct subnet_record *d = wins_subnet;
 
        static time_t lasttime = 0;
 
index 001695b3fbde22e8d70f01c281307c72cac471ac..e1738007df1b6caeea3fcdfe7be257861a966ea2 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -433,7 +433,7 @@ void reply_name_status(struct packet_struct *p)
       /* end of this name list: add wins names too? */
       struct subnet_record *w_d;
 
-      if (!(w_d = find_subnet(wins_ip))) break;
+      if (!(w_d = wins_subnet)) break;
 
       if (w_d != d)
       {
@@ -520,7 +520,7 @@ void reply_name_query(struct packet_struct *p)
   }
   else
   {
-    if (!(d = find_subnet(wins_ip)))
+    if (!(d = wins_subnet))
     {
       DEBUG(3,("name query: wins search %s not known\n",
                                    inet_ntoa(p->ip)));
index 30541034b81d8041c68365abb4f72ff53b92e3c2..565a15656568a64a17ff9a03622d08a4f56adabc 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -320,7 +320,7 @@ static void response_name_status_check(struct in_addr ip,
                            workgroup name to sync with. See 
                            response_server_check() */
                        sync_server(n->state,serv_name,
-                                   n->my_name,name.name_type, n->send_ip);
+                                   n->my_name,name.name_type, d, n->send_ip);
                }
        }
        else
index 1d3ff9e0ee336a6bca443c2c1ffd26f58b327943..218a7a349ef317b066a020bcc07b557d7d7f9099 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1996
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -96,7 +96,7 @@ void tell_become_backup(void)
    */
 
   struct subnet_record *d;
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
     {
       struct work_record *work;
       for (work = d->workgrouplist; work; work = work->next)
@@ -263,6 +263,7 @@ static void process_localnet_announce(struct packet_struct *p,uint16 command,cha
   tell_become_backup();
 #endif
 
+#if 0 /* JRA TEST - I Think this code should not be here */
   /* get the local_only browse list from the local master and add it 
      to ours. */
   if (command == ANN_LocalMasterAnnouncement)
@@ -270,15 +271,18 @@ static void process_localnet_announce(struct packet_struct *p,uint16 command,cha
     add_browser_entry(serv_name,dgram->dest_name.name_type,
                      work->work_group,30,p->ip,True);
   }
+#endif /* END JRA TEST */
 }
 
 /*******************************************************************
   process a master announcement frame
+  Domain master browsers recieve these from local masters. The Domain
+  master should then issue a sync with the local master, asking for
+  that machines local server list.
   ******************************************************************/
 static void process_master_announce(struct packet_struct *p,char *buf)
 {
   struct dgram_packet *dgram = &p->packet.dgram;
-  struct subnet_record *d = find_subnet_all(p->ip); /* Explicitly include WINS */
   char *name = buf;
   struct work_record *work;
   name[15] = 0;
@@ -287,9 +291,9 @@ static void process_master_announce(struct packet_struct *p,char *buf)
   
   if (same_context(dgram)) return;
   
-  if (!d
+  if (!wins_subnet
     {
-      DEBUG(3,("process_master_announce: Cannot find interface\n"));
+      DEBUG(3,("process_master_announce: No wins subnet !\n"));
       return;
     }
   
@@ -299,12 +303,12 @@ static void process_master_announce(struct packet_struct *p,char *buf)
       return;
     }
   
-  for (work = d->workgrouplist; work; work = work->next)
+  for (work = wins_subnet->workgrouplist; work; work = work->next)
   {
-    if (AM_MASTER(work) || AM_DOMMST(work) || AM_ANY_MASTER(work))
+    if (AM_MASTER(work) || AM_DOMMST(work))
     {
          /* merge browse lists with them */
-         add_browser_entry(name,0x1d, work->work_group,30,p->ip,True);
+         add_browser_entry(name,0x1d, work->work_group,30,wins_subnet,p->ip,True);
     }
   }
 }
@@ -434,7 +438,7 @@ static void send_backup_list(char *work_name, struct nmb_name *src_name,
 
 #if 0
 
-  for (d = subnetlist; d; d = d->next)
+  for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
   {
       struct work_record *work;
       
@@ -573,7 +577,7 @@ static void process_reset_browser(struct packet_struct *p,char *buf)
   if (state & 0x1)
     {
       struct subnet_record *d;
-      for (d = subnetlist; d; d = d->next)
+      for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
        {
          struct work_record *work;
          for (work = d->workgrouplist; work; work = work->next)
@@ -594,7 +598,7 @@ static void process_reset_browser(struct packet_struct *p,char *buf)
   if (state & 0x2)
     {
       struct subnet_record *d;
-      for (d = subnetlist; d; d = d->next)
+      for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
        {
          struct work_record *work;
          for (work=d->workgrouplist;work;work=remove_workgroup(d,work,True));
index eefb4162f79cc371ed656587da5fbb86efee45ca..550f3198f7cca9da093f4c40ac14d59d5a7d0fbb 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines and daemon - version 2
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -206,6 +206,13 @@ BOOL reload_services(BOOL test)
   load_interfaces();
   add_subnet_interfaces();
 
+  /* Do a sanity check for a misconfigured nmbd */
+  if(lp_wins_support() && *lp_wins_server()) {
+    DEBUG(0,("ERROR: both 'wins support = true' and 'wins server = <server>' \
+cannot be set in the smb.conf file. nmbd aborting.\n"));
+    exit(10);
+  }
+
   return(ret);
 }
 
@@ -546,6 +553,7 @@ static void usage(char *pname)
 
   if (strequal(lp_workgroup(),"*")) {
     DEBUG(0,("ERROR: a workgroup name of * is no longer supported\n"));
+    exit(1);
   }
 
   add_my_subnets(lp_workgroup());
index fa60b3ac35acd4b74a33349c36ceeb4787fe5fdb..7c23c64a96ad478afe54551d76b03f117dd1a4ab 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT netbios routines to synchronise browse lists
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -140,7 +140,13 @@ void sync_browse_lists(struct subnet_record *d, struct work_record *work,
 {
   uint32 local_type = local ? SV_TYPE_LOCAL_LIST_ONLY : 0;
 
-  if (!d || !work || !AM_ANY_MASTER(work)) return;
+  if (!d || !work ) return;
+
+  if(d != wins_subnet) {
+      DEBUG(0,
+        ("sync_browse_lists: ERROR sync requested on non-WINS subnet.\n"));
+      return;
+  }
 
   pid = getpid();
   uid = getuid();
index 961aaa9c9829086b1c9d5b6098ae82b60c03aa0f..40611e4c3a3798fe75002b37fcd50e3e878c43c5 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Parameter loading functions
-   Copyright (C) Karl Auer 1993,1994
+   Copyright (C) Karl Auer 1993,1997
 
    Largely re-written by Andrew Tridgell, September 1994
    
index 8030e4ab58345abf5d040f501de73901c4e4a23b..0fdde0348ffe64dd4257186beb3e7f7766f4baf5 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Parameter loading utlities
-   Copyright (C) Karl Auer 1993,1994
+   Copyright (C) Karl Auer 1993,1994,1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index d2071ace59470f7745875e8bb012f8ac71818190..c4dd9803ebe742f1e36079d17dd8919be1aa02f0 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    printing routines
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index f3c1ae020e1ed9dd7c1673fedfe1c25c2998c551..2437b8b17e8dd2f6165f45b72d0bebe7ccf2f0f6 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Directory handling routines
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 9a80a8d062d985551f61047c45d73e18e4aa957e..1f1ac8600a06208ad4cf93ef2bf104723e529e6c 100644 (file)
@@ -3,7 +3,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Inter-process communication and named pipe handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 5fdf31b7a419b3d60f206f869eb55f7cc31a697a..96e787b07fb14c1853dd638286b0b2471d7eee13 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Name mangling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 2ef5b246c44862838133a4b2f2d335203b31c38c..93a2d9d850a2c7be84e1ec7de311d1c658fbf55f 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    SMB messaging
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 2c24913c86a631897c8da202b21f7b08c72eaaed..7885fd1bbc9e97b54b52651dd7faf8903cef2ee5 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Password and authentication handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 06f3aeb0fb0a4a9d3f359b105c439c72695aa161..634d7af7f42b82c68c5229ece52333d73f93012d 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Pipe SMB reply routines
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 7f1692931c99f36b8de802fac7e677c9ddd43174..691d8fbb4e030751db80feb299d213ba5af8c5e1 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    file read prediction routines
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 05b40ada0f2160491207d36cb49c8638c4ea02b3..eba76d4c74b2384d2f3094a5f611b6e13649b521 100644 (file)
@@ -3,7 +3,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    support for quotas
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index f532d613b4ab9bf812115dad0388462e0f7309ea..bb75211deb5185e5c72a30cda229e6822d9139ff 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Main SMB reply routines
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 57611553cc8621c70a647f7ea7c79f87503a9ed2..0f72efc4788fa6a2fc1115f77e3617459c58ad8c 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Main SMB server routines
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index d547c796e0724bd3ba1160abd9b8b52afd131ed7..42ce7f60ad0cac6fc1d80b244dc5689d8a2ede67 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    external program running routine
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 2c0d5903e61e54de57211cfbd8845426ab954aed..38c7031b665b593c5d05a06f2e6ccbbbe6c7cadc 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    SMB transaction2 handling
-   Copyright (C) Jeremy Allison 1994
+   Copyright (C) Jeremy Allison 1994-1997
 
    Extensively modified by Andrew Tridgell, 1995
 
index 4fa0ed89da7b9c968c2b739f6476dba75b9d4835..e2c5f590b7aaf5906a002d333f7bd981a47f9c83 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    uid/user handling
-   Copyright (C) Andrew Tridgell 1992-1995
+   Copyright (C) Andrew Tridgell 1992-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index c96927683858d2c88ac4812184540c43d66b61f1..582f4eb6db387a599c4384d1689943e14905fbd6 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    NBT client - used to lookup netbios names
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index c79aa15c807638702c2560e81da69dd87fb59c4c..c820ad673a000a2c7f98bcb5a3c9932487f527b2 100644 (file)
@@ -2,7 +2,7 @@
 
 /*
  * Unix SMB/Netbios implementation. Version 1.9. smbpasswd module. Copyright
- * (C) Jeremy Allison 1995.
+ * (C) Jeremy Allison 1995-1997.
  * 
  * This program is free software; you can redistribute it and/or modify it under
  * the terms of the GNU General Public License as published by the Free
index 459349f5eb7896bf93aa98d177b568528462c82f..ba7c5f32105d074d318dc310ae2454e389c5b172 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    status reporting
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 7e05283625d4559b7a24eb34b3c1919c62aac5b4..81e69cd76fbe1006439c26c5d928b1a054fcd36a 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Test validity of smb.conf
-   Copyright (C) Karl Auer 1993, 1994
+   Copyright (C) Karl Auer 1993, 1994-1997
 
    Extensively modified by Andrew Tridgell, 1995
    
index 4709eb06917b27e158b7d9dceb238b8abaf64257..4a2ddb7c6350d9a481fd5c0c2764c0db9931ced0 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    test printer setup
-   Copyright (C) Karl Auer 1993, 1994
+   Copyright (C) Karl Auer 1993, 1994-1997
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by