summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-08-30 09:50:45 +0000
committerAndrew Tridgell <tridge@samba.org>1998-08-30 09:50:45 +0000
commit601f995ffbfa0ee477ea628d92b9660d6bdd8cbc (patch)
treeb0e81e3cd961d74ab6c941d25d72c764df1b3a69 /source
parent4460a1bc6aa7666d1c71d32ba73855d6ed32320a (diff)
downloadsamba-601f995ffbfa0ee477ea628d92b9660d6bdd8cbc.tar.gz
we we have successfully done a query on *<1b> from a wins server and
then obtained a node status response we need to remember the server name of the master browser so that other browse clients asking us for a workgroup list will get a entry for the master of that workgroup.
Diffstat (limited to 'source')
-rw-r--r--source/nmbd/nmbd_browsesync.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/source/nmbd/nmbd_browsesync.c b/source/nmbd/nmbd_browsesync.c
index bc0cf43f7c2..ac2cb5b71ec 100644
--- a/source/nmbd/nmbd_browsesync.c
+++ b/source/nmbd/nmbd_browsesync.c
@@ -496,6 +496,9 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub
struct in_addr from_ip)
{
struct work_record *work;
+ fstring server_name;
+
+ server_name[0] = 0;
DEBUG(3,("get_domain_master_name_node_status_success: Success in node status from ip %s\n",
inet_ntoa(from_ip) ));
@@ -525,11 +528,19 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub
p += 18;
+ if(!(nb_flags & NB_GROUP) && (name_type == 0x00) &&
+ server_name[0] == 0) {
+ /* this is almost certainly the server netbios name */
+ fstrcpy(server_name, qname);
+ continue;
+ }
+
if(!(nb_flags & NB_GROUP) && (name_type == 0x1b))
{
- DEBUG(5,("get_domain_master_name_node_status_success: IP %s is a domain \
-master browser for workgroup %s. Adding this name.\n", inet_ntoa(from_ip), qname ));
+ DEBUG(5,("get_domain_master_name_node_status_success: %s(%s) is a domain \
+master browser for workgroup %s. Adding this name.\n",
+ server_name, inet_ntoa(from_ip), qname ));
/*
* If we don't already know about this workgroup, add it
@@ -537,11 +548,18 @@ master browser for workgroup %s. Adding this name.\n", inet_ntoa(from_ip), qname
*/
if((work = find_workgroup_on_subnet( subrec, qname)) == NULL)
{
- /*
- * Add it - with an hour in the cache.
- */
- if((work = create_workgroup_on_subnet(subrec, qname, 60*60))==NULL)
- return;
+ struct nmb_name nmbname;
+ /*
+ * Add it - with an hour in the cache.
+ */
+ if(!(work= create_workgroup_on_subnet(subrec, qname, 60*60)))
+ return;
+
+ /* remember who the master is */
+ fstrcpy(work->local_master_browser_name, server_name);
+ make_nmb_name(&nmbname, server_name, 0x20, scope);
+ work->dmb_name = nmbname;
+ work->dmb_addr = from_ip;
}
break;
}