[jcifs] Issue listing "smb://"

Christopher R. Hertel crh at ubiqx.mn.org
Mon Jul 12 19:34:19 GMT 2004

On Mon, Jul 12, 2004 at 02:59:06PM -0400, Eric Glass wrote:
> Mike/Chris/all,
> Attached is a (possibly irrelevant) update to SmbFile; this addresses
> an issue I'm seeing in one of my environments.  Basically, the query
> for __MSBROWSE__ fails, so doing a listFiles on 'smb://' gives an
> UnknownHostException;

Right.  What that means is that there are no Local Master Browsers on the 
*local LAN*.  It doesn't mean that NetBIOS-based browsing isn't running, 
just that there are no local MBs.

> I'm assuming this is maybe due to a Win2k-only environment?

If that is the case, and if the W2K systems are all running naked
transport (no NBT) then yes, that would be one cause.

> In any case, the attached catches the
> UnknownHostException, and falls back to doing a NetServerEnum domain
> enumeration against the domain specified in "jcifs.smb.client.domain".

...which shouldn't work if NBT isn't being used.

Here's the deal:
  + The list returned by NetServerEnum is based on NetBIOS names.
    If NBT (or some other NetBIOS-based transport) isn't running then 
    there are no NetBIOS names, so NetServerEnum wouldn't have anything
    to return.
  + I don't remember the test results, but I know we played with this...
    Try sending a NetServerEnum to port 445.  I don't know if it works or 
    not, even if NBT is running on that machine.

So, if catching the UnknownHostException and doing a NetServerEnum against
jcifs.smb.client.domain works, then it's because there *is* NBT running 
somewhere (probably a different subnet) and jCIFS is finding the Domain 
Master Browser in the NBNS database.

> This may be a non-issue (i.e., just something flaky I'm doing); I'm
> not familiar enough with the browsing arena to say for sure.  It does
> work in other environments, though, and the "pure" Win2k scenario is
> the only thing I could think of off the top of my head.  Any thoughts?

The biggest problem here is that we don't know how to browse a non-NBT 
network.  I think there are some folks who know how to do this but it's 
been hard to work out details so I don't understand it myself.  It 
involves querying the Active Directory which first requires that you know 
how to find the Active Directory.  It *may* involve the non-standard UDP 
LDAP messages that Microsoft sends.

Second problem is that we need the RPC versions of the RAP calls to do 
this right even under NBT.  Sigh.

Chris -)-----

"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
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
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org

More information about the jcifs mailing list