Bug 3338 - libsmbclient query for NetBIOS name every opendir() calls with the same argument.
libsmbclient query for NetBIOS name every opendir() calls with the same argum...
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient
3.0.21
Other Linux
: P3 normal
: none
Assigned To: Derrell Lipman
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-12-17 16:12 UTC by Mikhail Kshevetskiy
Modified: 2005-12-29 11:34 UTC (History)
0 users

See Also:


Attachments
test3.c program to reproduce the problem (1.21 KB, text/plain)
2005-12-17 16:15 UTC, Mikhail Kshevetskiy
no flags Details
test3.c application output (299.48 KB, text/plain)
2005-12-17 16:17 UTC, Mikhail Kshevetskiy
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Kshevetskiy 2005-12-17 16:12:42 UTC
libsmbclient query for NetBIOS name every opendir() call with the same argument. If I am not mistake libsmbclient store servers information in cache, but libsmbclient do not use this informatiom (at least ip-address) for subsequent opendir() calls

This happen for example with the attached example. See the result.txt for program ouptut. Pay attention to position of "-- %d -------------" lines. It's clear from the output, that libsmbclient make a broadcast query to resolve LASKA hostname every time i use opendir("smb://laska")
Comment 1 Mikhail Kshevetskiy 2005-12-17 16:15:47 UTC
Created attachment 1620 [details]
test3.c program to reproduce the problem

Pay attention to position of "-- %d -------------" lines.
It's clear from the output, that libsmbclient make a broadcast query to
resolve LASKA hostname every time i use opendir("smb://laska")
Comment 2 Mikhail Kshevetskiy 2005-12-17 16:17:51 UTC
Created attachment 1621 [details]
test3.c application output

Pay attention to position of "-- %d -------------" lines.
It's clear from the output, that libsmbclient make a broadcast query to
resolve LASKA hostname every time i use opendir("smb://laska")
Comment 3 Derrell Lipman 2005-12-25 14:56:00 UTC
Try the SVN version now.  My recent changes causes a search for an existing server structure with the specified name, and to use it if it exists.  If it does not exist, then the previous sequence of events is accomplished to ascertain whether the name is a server or a workgroup, and to go from there.
Comment 4 Mikhail Kshevetskiy 2005-12-27 11:39:47 UTC
This solution of the problem is not good enougth.

Lets say you are using libnss_wins.so library via /etc/nsswitch.conf to resolve
NetBIOS name through the gethostbyname(). In this case you can resolve the
NetBIOS group. You'll get a list of computer in a group.

Now lets see what happen if I opendir("smb://smbgroup"). using gethostbyname()
i receive a list of ip-addresses, but smbc_server() will use only the first one.
So libsmbclient tried to connect with one of groups computer instead of master
browser. As a result I'll get a list of shares instead of computer list.

I think, the check for record in cache (without create if record not found)
will solve the problem
Comment 5 Mikhail Kshevetskiy 2005-12-29 11:27:32 UTC
Fixed in latest svn version
Comment 6 Mikhail Kshevetskiy 2005-12-29 11:29:46 UTC
Fixed in latest svn version