smbc_opendir() returns -1 but sets errno to 0
coolo at kde.org
Wed Nov 26 14:16:09 GMT 2003
On Wednesday 26 November 2003 01:51, Christopher R. Hertel wrote:
> > When receiving the responses, it therefore had access to
> > the IP address from which the response originated. Would it be an
> > appropriate modification to libsmbclient, to cache the IP address
> > from these responses, in order to behave in a more expected fashion?
> Well... no, not really. If there is a new election and some other node
> becomes LMB then the cache would be invalid. The real question is: Why did
> a query for smb://WORKGROUP_NAME/ return the IP address of something other
> than a browser for the WORKGROUP_NAME workgroup? Another question: Is it
> possible that the workgroup browse list was, in fact, empty? That can
> happen fairly easily.
> Ethereal... Your best friend.
The issue is quite clear and I once discussed this problem already with Richard:
The LMB is resolved through netbios and from the result only the host name is
taken and then resolved over DNS - which can (as you say) result in a different
IP. And when then the server behind the IP doesn't want the connection, then
libsmbclient is confused and returns this strange -1, errno = 0 case (which
resulted in the nice konqueror error "Unknown error: success" for quite
some time :)
libsmbclient needs to be changed to not resolve the name _again_ when it found
out the master browser. Just noone got to that so far. And yes, that's an invalid
network setup, but there are tons of reports for that - just one example:
There may be no I in TEAM, but a M and an E.
More information about the samba-technical