questionable code in nmbd/nmbd_packets.c?
Jeremy Allison
jallison at cthulhu.engr.sgi.com
Fri Aug 20 23:05:03 GMT 1999
Ok - here's my patch for this problem. Can you check in
your environment to see that it fixes it ?
Thanks,
Jeremy Allison,
Samba Team.
--------------------------cut here-----------------------
Index: nmbd/nmbd_incomingdgrams.c
===================================================================
RCS file: /data/cvs/samba/source/nmbd/nmbd_incomingdgrams.c,v
retrieving revision 1.14.2.1
diff -u -r1.14.2.1 nmbd_incomingdgrams.c
--- nmbd_incomingdgrams.c 1998/12/10 23:52:28 1.14.2.1
+++ nmbd_incomingdgrams.c 1999/08/20 23:02:46
@@ -572,6 +572,12 @@
p = skip_string(p,1);
/* Look for backup browsers in this workgroup. */
+
+ /*
+ * NB. Note that the struct work_record here is not neccessarily
+ * attached to the subnet *subrec.
+ */
+
for (servrec = work->serverlist; servrec; servrec = servrec->next)
{
len = PTR_DIFF(p, outbuf);
@@ -630,6 +636,7 @@
uint32 token = IVAL(buf,1); /* Sender's key index for the workgroup. */
int name_type = dgram->dest_name.name_type;
char *workgroup_name = dgram->dest_name.name;
+ struct subnet_record *search_subrec = subrec;
DEBUG(3,("process_get_backup_list_request: request from %s IP %s to %s.\n",
nmb_namestr(&dgram->source_name), inet_ntoa(p->ip),
@@ -646,12 +653,11 @@
return;
}
- if((work = find_workgroup_on_subnet(subrec, workgroup_name)) == NULL)
- {
- DEBUG(0,("process_get_backup_list_request: Cannot find workgroup %s on \
-subnet %s.\n", workgroup_name, subrec->subnet_name));
- return;
- }
+ /*
+ * If the packet was sent to WORKGROUP<1b> instead
+ * of WORKGROUP<1d> then it was unicast to us a domain master
+ * browser. Change search subrec to unicast.
+ */
if(name_type == 0x1b)
{
@@ -664,6 +670,8 @@
and I am not a domain master browser.\n", workgroup_name));
return;
}
+
+ search_subrec = unicast_subnet;
}
else if (name_type == 0x1d)
{
@@ -681,6 +689,13 @@
{
DEBUG(0,("process_get_backup_list_request: Invalid name type %x - should be
0x1b or 0x1d.\n",
name_type));
+ return;
+ }
+
+ if((work = find_workgroup_on_subnet(search_subrec, workgroup_name)) == NULL)
+ {
+ DEBUG(0,("process_get_backup_list_request: Cannot find workgroup %s on \
+subnet %s.\n", workgroup_name, search_subrec->subnet_name));
return;
}
Index: nmbd/nmbd_packets.c
===================================================================
RCS file: /data/cvs/samba/source/nmbd/nmbd_packets.c,v
retrieving revision 1.23.2.3
diff -u -r1.23.2.3 nmbd_packets.c
--- nmbd_packets.c 1998/12/17 21:38:12 1.23.2.3
+++ nmbd_packets.c 1999/08/20 23:02:46
@@ -1076,15 +1076,6 @@
case ANN_GetBackupListReq:
{
debug_browse_data(buf, len);
-
- /* This is one occasion where we change a subnet that is
- given to us. If the packet was sent to WORKGROUP<1b> instead
- of WORKGROUP<1d> then it was unicast to us a domain master
- browser. Change subrec to unicast.
- */
- if(dgram->dest_name.name_type == 0x1b)
- subrec = unicast_subnet;
-
process_get_backup_list_request(subrec, p, buf+1);
break;
}
--------------------------cut here-----------------------
--
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------
More information about the samba-technical
mailing list