[jcifs] Master Browsing Caching

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Fri Oct 25 13:31:15 EST 2002

> -----Original Message-----
> From:	Matthew Tippett [SMTP:matthew.tippett at sympatico.ca]
> Sent:	Thursday, October 24, 2002 10:10 PM
> To:	jcifs at lists.samba.org
> Subject:	[jcifs] Master Browsing Caching
> Hello,
> A quick question about a couple of possible ways to work with the master 
> browser.
> I want to scan the network for all domains, in our network we have a 
> number of 'interesting' master browsers.  Some won't let us connect to 
> the IPC$ share
	That is pretty interesting considering you have to connect to IPC$ to retrieve
	the browse list.

> , others are set up to use plain text passwords.
	Also interesting considering retrieving the browse list usually uses null
	credentials but if not you can set disablePlainTextPasswords = false.

> So, the two areas that I am interested in 'enhancing' are as follows.
> 	o The __MSBROWSE__ name should not be cached in NbtAddress

>  :- a quick 
> change to getCachedAddress stops the cached name ever getting used.
> 	   	if (hostName.name.equals(NbtAddress.MASTER_BROWSER_NAME)) { return 
> null;  }
	Set cachePolicy = -1.

	All jcifs properties are described on the Overview page of the API documentation.

> 	o Currently the NameServiceClient  waits on the first Name response 
> before continuing, if there is more than one response (if there are 
> multiple domains on the network), then we should probably wait for all 
> responses within 500 ms of the first response, and then interrogate all 
> the master browsers individually you should find yourself with an very 
> complete idea of domains on the network.
	We're not going to do this. We do what NT does. You should be able to collect
	domain names fine listing "smb://". Sure it *might* create a more complete list if
	you have machines going up and down like yo-yos but it's not behavior that is
	observed in any other clients I don't really see the benefit.

>   From my understanding of CIFS 
> each WORKGROUP/DOMAIN has it's own Master Browser, even though the 
> master browsers should have all DOMAINS in their browselist.
	This is not quite right. Each subnet has at least one master browser. I don't know
	if there is a master browser for each workgroup. I don't think so. Chris?

> As an aside, I have noticed that in NameServiceClient.java at line 367. 
> 	name.name != NbtAddress.MASTER_BROWSER_NAME
> is used, I would assume that
> 	(! name.name.equals(NbtAddress.MASTER_BROWSER_NAME))
> should be used instead, since the != would only compare the object 
> references.
	To query for a master browser you do:

	  NbtAddress.getByName( NbtAddress.MASTER_BROWSER_NAME );

	in which case the same String object is always passed in and therefore
	comparing object references is indeed the correct behavior. In theory you
	could do getByName( "\u0001\u0002__MSBROWSE__\u0002" ) but I'd
	make sure you're wearing clean underwear before you try that!

> Interested in hearing what people think...
> Matt

More information about the jcifs mailing list