libsmb documentation

Luke Kenneth Casson Leighton lkcl at
Wed Aug 11 18:53:12 GMT 1999

> One benefit (for the network that I was on) was that smbclient would use WINS,

it uses a function called resolve_host() which checks smb.conf resolve
order, which is a similar parameter to the effect of /etc/resolv.conf but
it includes "nbt-broadcast" and "nbt-wins" and "lmhosts".

so, you can do dns lookup or netbios lookup etc etc from smbclient, and
this function, whilst it could be added to smblib, is not in the
currently available versions of smblib.


> while smblib wouldn't (am I right in saying this?).  With all of the computers
> on multiple subnets, this made it all possible.  The hardest part (read:
> impossible) was getting all 1200 people to set their computers up to use WINS.

:-) what a surprise :-)  use dhcp, then (which brings its own problems)


> - Philip
> Philip Carmichael
>   pgc at
> I am in the process of writing a program to index a SMB network and
> provide a web based search engine for the database.  I had originally
> considered fork()ing and running smbclient to retrieve indexes, but
> concluded that this was a bad idea, especially since the network on
> which I am developing this software has *thousands* of machines, many of
> which have quite a bit of stuff on them.  The obvious upshot of this is
> that forking off a zillion copies of smbclient would slow things down a
> LOT.
> So I went looking for some kind of library interface.  The first thing I
> found (it serendipitously appeared on freshmeat one day) was libsmb.
> Note that this is *not* the libsmb that is in the Samba distribution.
> It is a separate implementation of the client side of the SMB protocol
> in C++ [1].  Given that the program I'm writing is in C++, it was an
> extra plus that this was a C++ interface.
> However, I saw in the ChangeLog for Samba 2.0.5a that smbmount, etc. had
> been moved over to using libsmb, and went Oh Dear, Houston, We Have A
> Problem (or something like that).  So I looked at the libsmb that's in
> the Samba distribution, and it didn't look too bad, except that I
> couldn't find any documentation on how to use it, and looking at a
> nearly 3000 line program (client.c) to figure it out was not my idea of
> a good use of time.
> So my question comes down to this:
> What should someone who wants to develop an application that uses the
> SMB protocol do when fork()ing smbclient is not an option?  I am a big
> fan of code reuse, and also of not forcing people to install all sorts
> of uncommon libraries and other software in order to use your software.
> Since nearly anyone who wanted to use my software would probably already
> have Samba, and other parts of it would use the Samba programs anyways
> (it would contain an SMB2WWW-like interface), it would be nice to be
> able to use the SMB code in Samba.
> I look forward to your thoughts,
>      -Matt
> [1]
> You can find this libsmb at

<a href="mailto:lkcl at"   > Luke Kenneth Casson Leighton    </a>
<a href=""> Samba and Network Development   </a>
<a href=""        > Samba Web site                  </a>
<a href=""      > Internet Security Systems, Inc. </a>

More information about the samba-technical mailing list