this is an interim fix for nmbd not registering DOMAIN#1b with WINS
authorAndrew Tridgell <tridge@samba.org>
Sun, 28 Jul 2002 07:15:42 +0000 (07:15 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 28 Jul 2002 07:15:42 +0000 (07:15 +0000)
when a PDC. The fix does not iterate over all WINS tags, which it
should do, but after having looked at doing that it gets *very* messy
to do with our current code base.
(This used to be commit 434e5124db28134ebfc9840cf0839d77987db65e)

source3/nmbd/nmbd_packets.c

index 4bd949f5a3e7ea0120bbda82fc80dcd4b9e04f18..105fb60e99c071d281cd149b78dcd47a1a1b9e3f 100644 (file)
@@ -705,14 +705,33 @@ struct response_record *queue_query_name( struct subnet_record *subrec,
 {
   struct packet_struct *p;
   struct response_record *rrec;
+  struct in_addr to_ip;
 
   if(assert_check_subnet(subrec))
     return NULL;
 
+  to_ip = subrec->bcast_ip;
+  
+  /* queries to the WINS server turn up here as queries to IP 0.0.0.0 
+     These need to be handled a bit differently */
+  if (subrec->type == UNICAST_SUBNET && is_zero_ip(to_ip)) {
+         /* what we really need to do is loop over each of our wins
+          * servers and wins server tags here, but that just doesn't
+          * fit our architecture at the moment (userdata may already
+          * be used when we get here). For now we just query the first
+          * active wins server on the first tag. */
+         char **tags = wins_srv_tags();
+         if (!tags) {
+                 return NULL;
+         }
+         to_ip = wins_srv_ip_tag(tags[0], to_ip);
+         wins_srv_tags_free(tags);
+  }
+
   if(( p = create_and_init_netbios_packet(nmbname, 
                                          (subrec != unicast_subnet), 
                                          (subrec == unicast_subnet), 
-                                         subrec->bcast_ip)) == NULL)
+                                         to_ip)) == NULL)
     return NULL;
 
   if(lp_bind_interfaces_only()) {