[jcifs] querying a wins server for a list of workgroups

Christopher R. Hertel crh at ubiqx.mn.org
Sun Jul 29 02:10:52 EST 2001

"Michael B. Allen" wrote:
> > That will find a Domain Master Browser, not a Local Master Browser. 
> > Still, a DMB can be useful, if you know how to talk to it.
> So you can't just do the standard NetServerEnum RAP call on it?

Darned if I know.  :)

Hang on, maybe you can.  I *think* the DMB is always also an LMB (but I'm
not sure).  Samba has tuning for this but I think that an NT box is always
an LMB if its a DMB.

Anyway, there are calls that can be made to the DMB to grab its copy of
the browse list.  I'm not sure how much they differ from calls to an LMB.

> > BTW, I found something very, very interesting when I was grubbing
> > around in some old docs.  You can send a query to the WINS server for
> > *0x1B (that's a wildcard query with a suffix of 0x1B) and the WINS
> > server will return a list of all the DMBs it knows about.
> Was this the thing that Richard said only responded to 137 though?

I don't think so, but it's possible.  I thought Richard was talking about
port 138.  Perhaps we should ping him.

> > Yes, I see the problem.  It would be nice to be able to query remote
> > LMBs, but as I think about it I don't see this as something that
> > should be done in an SMB URL string.  LMBs have a habit of 'moving'
> > around within a subnet, so the URL string would not be reliable. 
> > That's not consistent with the purpose of URLs.
> Well, the URL for addressing a workgroup would not change. It would just
> be like smb://name. The code would just have to query the NAME<0x20>,
> NAME<0x1D>, and now NAME<0x1B> all in parallel. Actually this might be
> as easy as just switchingg the 0x1D for 0x1B. Talk about a one-liner,
> how about 1 character -- wouldn't that be embarrassing :~P

Call it a jCIFS feature then.  :)

Hmmm...  You need to query both the 0x1D and the 0x1B.  There may not be a
DMB (these are, of course, optional).  Also, note that 0x1B names should
come from the NBNS.  If the name is not in the NBNS then no other LMBs can
find the DMB so the DMB won't have a cross-subnet list (making it useless).

Also, what I was talking about above was querying remote *Local* Master
Browsers, not the Domain Master Browser.  Querying the DMB was an idea you
threw at me a few weeks ago (which got me thinking, which got me reading,
which got me into the mess I'm discussing now).  ;)

So, yes, as a jCIFS feature you might do an 0x20 query (M/H mode), an 0x1B
query (P mode), and an 0x1D query (B mode only) to find out who thinks
they own that name.  If you get an 0x1B response you can get the browse list
from the DMB if you want (and if you know how to ask, which I don't (yet)).

Note that there is no real advantage to getting the browse list from the DMB
instead of the LMB.  The DMB might have more up-to-date information about
servers on remote subnets, but if it does that means it hasn't done a sync
with the local LMB so the LMB might have more up-to-date information about
local servers.

I hate browsing.

Chris -)-----

Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org

More information about the jcifs mailing list