[WORKAROUND] Re: [Samba] duplicate domains in browse list

Jeremy Allison jra at samba.org
Thu May 27 22:51:45 GMT 2004

On Thu, May 27, 2004 at 08:45:22PM +0200, Joerg Pulz wrote:
> Hash: SHA1
> On Thu, 27 May 2004, Jeremy Allison wrote:
> >Ok, all the changes here are just to reduce the size of string
> >used from an unstring to an nstring. Unfortunately this cannot
> >be correct as it would cause truncation for multibyte characters
> >in code pages like Japanese.
> >
> >It may be that the change you added causes extra non-zero bytes not
> >to be examined in the comparison functions. If that is the case
> >the following patch should have the same effect. If you could test
> >this instead of your patch I'd appreciate it.
> I've tested the small patch on one DMB but it did NOT work.
> I stopped 'smbd' and 'nmbd', removed the browse.dat file, installed the 
> new binaries, and started the whole thing.
> as soon as the browse.dat file is recreated, it contains domain names with 
> trailing spaces until MAX_NETBIOSNAME_LEN is reached.
> I had to stop the processes to not pollute all browse lists again.

Ok, here is one definate bug I've found - we were not converting correctly to
UNIX charset before sending the mailslot in the function :


However, I don't think this would cause the problem. Here is the
fix for this I've just checked in, if you could test this I'd appreciate

-------------- next part --------------
Index: nmbd/nmbd_browsesync.c
--- nmbd/nmbd_browsesync.c	(revision 926)
+++ nmbd/nmbd_browsesync.c	(working copy)
@@ -103,6 +103,7 @@
 	pstring outbuf;
 	unstring myname;
+	unstring dmb_name;
 	char *p;
 	if(ismyip(work->dmb_addr)) {
@@ -135,8 +136,10 @@
 					work->work_group );
+	/* Target name for send_mailslot must be in UNIX charset. */
+	pull_ascii_nstring(dmb_name, sizeof(dmb_name), work->dmb_name.name);
 	send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
-		global_myname(), 0x0, work->dmb_name.name, 0x0, 
+		global_myname(), 0x0, dmb_name, 0x0, 
 		work->dmb_addr, FIRST_SUBNET->myip, DGRAM_PORT);

More information about the samba mailing list