[jcifs] Issue listing "smb://"
eric.glass at gmail.com
Fri Jul 16 02:25:29 GMT 2004
> If given "SMB://"
> 1) Look for the __MSBROWSE__ name and choose one of the responding nodes.
> Cross your fingers and hope that it's been up long enough that it has
> achieved a reasonable degree of convergence.
Currently, jCIFS just does #1 (__MSBROWSE__). I don't know that we
have any means of specifying we are in "P" mode, so I don't think we'd
ever skip this; the earlier patch just catches the
UnknownHostException that occurs if no __MSBROWSE__ is found.
> 2) If #1 fails, contact the NBNS for a DMB (any DMB... If you've got a
> default workgroup name, try that. Else, try *<1B> which may also fail.
> 3) If in 'P' mode skip step 1, if in 'B' mode skip step 2.
> 4) If none of that works the query fails.
The patch falls back to doing:
String host = Config.getProperty("jcifs.smb.client.domain");
return UniAddress.getByName(host, true);
This eventually winds up calling UniAddress.lookupServerOrWorkgroup;
this gets kind of funky since it loops through the defined
"jcifs.resolveOrder" list. So depending on how the resolve order is
specified, this could give mixed results.
I think this fallback could probably be better refined to something
like this (and I think this more-or-less captures Chris' process):
String host = Config.getProperty("jcifs.smb.client.domain", "*");
NbtAddress address = NbtAddress.getByName(host, 0x1b, null,
return new UniAddress(address);
So if the __MSBROWSE__ fails, the NBNS is queried using <1B> for
"jcifs.smb.client.domain" if set, or "*" otherwise. I *think* this
should wind up getting the DMB for the default workgroup, or any DMB
(if no default workgroup is specified and the NBNS is Samba).
More information about the jcifs