libsmbclient API for querying LMB?

Derrell.Lipman at UnwiredUniverse.com Derrell.Lipman at UnwiredUniverse.com
Mon Nov 10 19:57:55 GMT 2003


David Wuertele <dave-gnus at bfnet.com> writes:

> Me> I would like to get an array of struct containing the current
> Me> browse list from the LMB.  Is there a libsmbclient API for doing
> Me> this?
>
> Jelmer> Use smb:// for browsing the list of workgroups/domains or
> Jelmer> smb://name-of-workgroup for browsing the list of servers in a
> Jelmer> workgroup/domain.
>
> Thanks, but I guess what I was really asking was this:
>
> Is there a *function* in libsmbclient, like
> "get_browse_list(&this_workgroup)", that I can call from my C program,
> to have it query the LMB and return the list of servers in a
> workgroup?

Not a single function (at least not in the "published" interface) but a small
sequence of functions will do it for you...

Calling smbc_opendir() with "smb://" as the pathname, followed by some number
of calls to smbc_readdir() and then smbc_closedir() will give you the list of
servers.  Use "smb://workgroup_name" as the path parameter to smbc_opendir()
to get the servers in the workgroup, and "smb://server_name" to get the list
of services provided by the server.

In lieu of many calls to smbc_readdir(), you should also be able to call
smbc_getdents() to retrieve many at a time.

(I don't have a libsmbclient.h available on this computer.  I believe the
function names I gave you are correct; if not, they're similar and should be
easily found.)

Derrell



More information about the samba-technical mailing list