Wrong domain master name

Jerome Borsboom j.borsboom at erasmusmc.nl
Thu May 13 08:28:34 GMT 2004

When a, differently named, windows 2000 domain server is setup 
on the same network to use WINS resolution from a samba 
server, the name of that server is registered wrongly into the 
WINS database. The registered name includes the <1b> that is 
at the end if the received name and the spaces used for 
padding the name to 15 characters. The problem seems to be 
that the trim_char function does not trim the spaces off, 
because of the <1b> character at the end of the name.

I have solved the problem with the patch below, but I do not 
feel that it is the most elegant solution.

Additionally, when the server is turned off, the nmbd log file 
is flooded with messages that the server cannot be contacted. 
This does not seem an error condition to me, so maybe a 
loglevel 0 is a bit too high for this error.

Jerome Borsboom

[2004/05/13 09:30:01, 1] libsmb/cliconnect.c:cli_connect(1297)
  Error connecting to (No route to host)
[2004/05/13 09:42:02, 0] nmbd/nmbd_browsesync.c:get_domain_master_name_node_status_fail(486)
  Doing a node status request to the domain master browser at IP failed.
  Cannot get workgroup name.

--- samba-3.0.4/source/nmbd/nmbd_browsesync.c	2004-04-04 09:37:36.000000000 +0200
+++ samba-3.0.4/source/nmbd/nmbd_browsesync.c	2004-05-12 21:04:42.000000000 +0200
@@ -424,9 +424,10 @@
 			uint16 nb_flags;
 			int name_type;
-			pull_ascii_nstring(qname, sizeof(qname), p);
 			name_type = CVAL(p,15);
 			nb_flags = get_nb_flags(&p[16]);
+			p[15] = '\0';
+			pull_ascii_nstring(qname, sizeof(qname), p);
 			trim_char(qname,'\0',' ');
 			p += 18;

More information about the samba-technical mailing list