Browsing problems in Samba 1.9.17alpha5.

Jeremy Allison jallison at whistle.com
Tue Aug 12 22:34:55 GMT 1997


All,

	Several people have reported problems with the
cross subnet browsing code in the new Samba 1.9.17 alpha
series.

Some fantastic debugging work by Bernhard Laeser 
<nlaesb at ascom.ch> has revealed a nasty bug in the 
browse code. It bites when the WINS server is on a 
different machine from the NT PDC or Samba domain 
master browser.

Please try applying the following patch to the 1.9.17alpha5
code and let me know if the cross subnet browsing problems
are fixed.

Once again many thanks to Bernhard for his work (Luke and I
were *very* embarassed when looking over the code after he
pointed out the bug :-).

Regards,

	Jeremy Allison,
	Samba Team.

-----------cut here-------------------------------
--- nameservresp.c.orig	Tue Aug 12 14:32:42 1997
+++ nameservresp.c	Tue Aug 12 15:01:43 1997
@@ -143,21 +143,40 @@
   NAME_QUERY_SRV_CHK, and NAME_QUERY_FIND_MST dealt with here.
  
****************************************************************************/
 static void response_server_check(struct nmb_name *ans_name, 
-		struct response_record *n, struct subnet_record *d)
+        struct response_record *n, struct subnet_record *d, struct
packet_struct *p)
+{
+    struct nmb_packet *nmb = &p->packet.nmb;
+    struct in_addr send_ip;
+    enum state_type cmd;
+
+    /* This next fix was from Bernhard Laeser <nlaesb at ascom.ch>
+       who noticed we were replying directly back to the server
+       we sent to - rather than reading the response.
+     */
+
+    if (nmb->header.rcode == 0 && nmb->answers->rdata)
+      putip((char*)&send_ip,&nmb->answers->rdata[2]);
+    else
 {
+      
+        DEBUG(2,("response_server_check: name query for %s failed\n", 
+              namestr(ans_name)));
+        return;
+      }
+
     /* issue another state: this time to do a name status check */
 
-    enum state_type cmd = (n->state == NAME_QUERY_DOM_SRV_CHK) ?
+    cmd = (n->state == NAME_QUERY_DOM_SRV_CHK) ?
 	      NAME_STATUS_DOM_SRV_CHK : NAME_STATUS_SRV_CHK;
 
-    /* initiate a name status check on the server that replied 
-       in addition, the workgroup being checked has been stored
+    /* initiate a name status check on address given in the reply
+       record. In addition, the workgroup being checked has been stored
        in the response_record->my_name (see announce_master) we
        also propagate this into the same field. */
     queue_netbios_packet(d,ClientNMB,NMB_STATUS, cmd,
 				ans_name->name, ans_name->name_type,
 				0,0,0,n->my_name,NULL,
-				False,False,n->send_ip,n->reply_to_ip);
+				False,False,send_ip,n->reply_to_ip);
 }
 
 
@@ -720,7 +739,7 @@
     case NAME_QUERY_SRV_CHK:
     case NAME_QUERY_FIND_MST:
       {
-	response_server_check(ans_name, n, d);
+	response_server_check(ans_name, n, d, p);
 	break;
       }
------------------end-------------------------------------------


More information about the samba mailing list