HOWTO add static entries to WINS?

Martin Sheppard martin.sheppard at hsn.csiro.au
Mon Feb 26 07:07:03 GMT 2001


At 02:43 PM 23/02/2001 +0100, Axel Thimm wrote:
>Dear Samba gurus,
>
>On Fri, Feb 09, 2001 at 01:31:03PM +0100, werner maes wrote:
> > I've read the Netbios.txt documentation and it says:
> > "The WINS server _can_ have static NetBIOS entries added to its database
> > (usually for security reasons you might want to consider putting your 
> domain
> > controllers or other important servers as static entries,but you should not
> > rely on this as your sole means of security),but for the most part, NetBIOS
> > names are registered dynamically."
> >
> > How can you add static Netbios entries (f.e. for a logon server) to a Samba
> > based WINS server?
>
>On Thu, Feb 22, 2001 at 12:25:31AM +0100, Axel Thimm wrote:
> > Did you get any useful responses?
>
>On Thu, Feb 22, 2001 at 08:55:57AM +0100, werner maes wrote:
> > No, I did not.
> > But I seem to have found a solution myself.
> > It's possible to add entries to the wins.dat file and this works.
> > For example, I added a domain logon server on a distant subnet and I
> > was able to logon.
> > The syntax however is important.
>
>Is there any (undocumented) method for adding static entries to the WINS
>database? I guess this has not been implemented yet - is then Werner's method
>a valid workaround (stop nmbd, add the entry to wins.dat, restart nmbd)?
>Wouldn't this entry expire in some way or another?

You can use this patch I made against Samba 2.0.7. Normally entries in the 
lmhosts file are only used locally on the machine with the lmhosts file. 
This patch adds them to the WINS database, so they are served out as well. 
It seemed to work for me, but I must say that I didn't look at the code to 
expire WINS entries, so that may still be a problem. I'm also not sure if 
it actually gives you any more security like the documentation says it does.

--- samba-2.0.7/source/nmbd/nmbd_lmhosts.c.orig Thu Aug 24 16:37:35 2000
+++ samba-2.0.7/source/nmbd/nmbd_lmhosts.c      Thu Aug 24 16:40:43 2000
@@ -49,12 +49,17 @@
      struct subnet_record *subrec = NULL;
      enum name_source source = LMHOSTS_NAME;

+    /* add hosts to the wins server database if possible */
+    subrec = wins_server_subnet;
+
      /* We find a relevent subnet to put this entry on, then add it. */
      /* Go through all the broadcast subnets and see if the mask matches. */
-    for (subrec = FIRST_SUBNET; subrec ; subrec = 
NEXT_SUBNET_EXCLUDING_UNICAST(subrec))
-    {
-      if(same_net(ipaddr, subrec->bcast_ip, subrec->mask_ip))
-        break;
+    if(subrec == NULL) {
+      for (subrec = FIRST_SUBNET; subrec ; subrec = 
NEXT_SUBNET_EXCLUDING_UNICAST(subrec))
+      {
+       if(same_net(ipaddr, subrec->bcast_ip, subrec->mask_ip))
+         break;
+      }
      }

      /* If none match add the name to the remote_broadcast_subnet. */





More information about the samba-technical mailing list