libsmbclient and smb_opendir: problem with workgroup
Christopher R. Hertel
crh at ubiqx.mn.org
Sat Jun 12 22:57:54 GMT 2004
On Fri, Jun 11, 2004 at 09:13:00PM -0300, Andreas wrote:
> I have a machine in the MYGROUP workgroup that is misbehaving:
>
> [andreas at pandora source]$ smbclient -L duckman -N
> session request to DUCKMAN failed (Call timed out:
> server did not respond after 20000 milliseconds)
> (...)
>
> It does exist:
> [andreas at pandora source]$ nmblookup duckman
> querying duckman on 10.0.7.255
> 10.0.4.149 duckman<00>
Are you sure that filesharing is enabled on that system? Do an
'nmblookup -S duckman'
If the duckman<20> name is not registered, the there is no sharing active.
If sharing is active, then (at worst) you should get an authentication
error.
> I don't have shell access to see what is wrong, but that is not the point.
> The problem is that this missbehaviour is causing network browsing to fail
> as a whole.
Why would it do that? Are you certain that this particular node is the
Local Master Browser? Try doing:
'nmblookup -B 255.255.255.255 MYGROUP#1D'
and then send a
'nmblookup -A <IP>'
to the IP address returned by the first query. That will tell you which
node (on the local subnet) is the LMB.
> On my client machine I have "workgroup=MYGROUP" and this causes
> smbc_opendir("smb://") to return -1.
Assuming this works properly (I have not tested it in a while) the above
query *might* attempt to gather the workgroup list from the default LMB
(which would be MYGROUP#1D). If there is no LMB for that workgroup on the
local subnet then it would need to find a Domain Master Browser (DMB) for
that workgroup.
I'm speculating. I haven't looked at the code and I don't know how the
query is sent out. I have a long list in my head of things that could go
wrong. I'd need a better idea of how the network is layed out, the full
config, and packet traces to really know what's up.
> If, however, I use "workgroup=SOMEGARBAGE" (SOMEGARBAGE doesn't exist),
> then smbc_opendir() works. Now, as I understand it, the "smb://" url is
> supposed to be used to list all workgroups in the network, why should
> my own workgroup matter?
Perhaps the lookup faiure results in a different set of queries being sent
out. When querying for "smb://", and LMB or DMB will do the job.
> Or does this "search" need to have some workgroup, even if it is an
> non-existing one?
In theory, you can search for the workgroup list in four different ways:
1) Send a broadcast query for the Local Master for your own workgroup.
If it responds, ask it for the workgroup list.
2) Send a broadcast query for any local LMBs (for any workgroup) and ask
one or more of them for a list of known workgroups. This is done by
querying for the special __MSBROWSE__ name.
3) Query the NBNS (WINS server) for the Domain Master Browser for you
workgroup/NT Domain. If there is one, you can query it for the
workgroup list.
4) If the NBNS is a Samba server, you can query for *#1D, in which case
you will get back a list of all known Domain Master Browsers (for any
workgroup that has a DMB). You may then query one or more of those for
the workgroup list.
Client code may use one or more of the above. The first is the "correct"
way to do things (and, of course, it doesn't always work). The third
option is the "correct" way to do things if you're a P-mode node.
I don't know what libsmbclient actually does.
Hope that helps.
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 samba-technical
mailing list