smbc_opendir() returns -1 but sets errno to 0

Derrell.Lipman at Derrell.Lipman at
Tue Nov 25 14:59:53 GMT 2003

I encountered an "error" (-1 returned) from libsmbclient's smbc_opendir()
function with an errno value of 0 (success).  As is intended, if you browse
the network with smbc_opendir("smb://WORKGROUP") to enumerate the servers,
a connection to the master browser for WORKGROUP (call it MB) is established.
If, however, the local name server provides an IP address for MB which is
different than the machine with netbios name MB, the connection is made to the
incorrect machine.  If that machine happens to be running samba or is a
windows machine, it will respond to the enumServers query with a successful
response, but with a count of zero servers.

Granted, all of this is likely considered a configuration error at the name
server, two questions arise:

1. Trying to leave "cleanliness of design" issues aside, might there be any
   legitimate reason to have a machine with netbios name MB, and a different
   machine with hostname MB configured in the name server? 

2. Given that smbc_opendir() is returning -1, should errno be set to something
   other than 0 to help identify the problem -- even though the NT errno from
   which errno is being derived was "success"?



More information about the samba-technical mailing list