summaryrefslogtreecommitdiffstats
path: root/source/namedbwork.c
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-04-09 01:19:25 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-04-09 01:19:25 +0000
commita82476eee2c521e5eed092bc367da0a7cef23de1 (patch)
tree36f68ea5347de58b161e6231fa1f0252c246bffc /source/namedbwork.c
parentdeedac6523cdc435a1a26ad0c13d7a53042aafb6 (diff)
downloadsamba-a82476eee2c521e5eed092bc367da0a7cef23de1.tar.gz
samba-a82476eee2c521e5eed092bc367da0a7cef23de1.tar.xz
samba-a82476eee2c521e5eed092bc367da0a7cef23de1.zip
Large changes from jra@cygnus.com. Mainly browser updates.
access.c: Fixed crash if yp domain unavailable. includes.h: Moved ifdefs for minor platform. interface.c: Changed name of ipgrp to wins_ip to make it clearer. loadparm.c: Changed default of wins support to 'no'. nameannounce.c: Many changes to fix cross subnet browsing. namebrowse.c: Many changes to fix cross subnet browsing. namedbname.c: Many changes to fix cross subnet browsing. namedbresp.c: Many changes to fix cross subnet browsing. namedbsubnet.c: Many changes to fix cross subnet browsing. namedbwork.c: Many changes to fix cross subnet browsing. nameelect.c: Many changes to fix cross subnet browsing. namelogon.c: Many changes to fix cross subnet browsing. namepacket.c: Many changes to fix cross subnet browsing. nameresp.c: Many changes to fix cross subnet browsing. nameserv.c: Many changes to fix cross subnet browsing. nameserv.h: Many changes to fix cross subnet browsing. nameservreply.c: Many changes to fix cross subnet browsing. nameservresp.c: Many changes to fix cross subnet browsing. namework.c: Many changes to fix cross subnet browsing. nmbd.c: Change to search wins subnet. nmbsync.c: Change to check if we are any master before proceeding. proto.h: Added find_subnet_all() and check_work_servertype(). util.c: Moved 'done' settings on name resolution.
Diffstat (limited to 'source/namedbwork.c')
-rw-r--r--source/namedbwork.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/source/namedbwork.c b/source/namedbwork.c
index 0cfc47c41a8..80a670fea84 100644
--- a/source/namedbwork.c
+++ b/source/namedbwork.c
@@ -38,7 +38,7 @@ extern int DEBUGLEVEL;
/* this is our domain/workgroup/server database */
extern struct subnet_record *subnetlist;
-extern struct in_addr ipgrp;
+extern struct in_addr wins_ip;
int workgroup_count = 0; /* unique index key: one for each workgroup */
@@ -201,7 +201,7 @@ struct work_record *find_workgroupstruct(struct subnet_record *d,
if ((work = make_workgroup(name)))
{
- if (!ip_equal(d->bcast_ip, ipgrp) &&
+ if (!ip_equal(d->bcast_ip, wins_ip) &&
lp_preferred_master() &&
strequal(lp_workgroup(), name))
{
@@ -248,3 +248,42 @@ 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;
+}