libsmb documentation

Matthew Gabeler-Lee msg2 at
Tue Aug 10 21:27:50 GMT 1999

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

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,

You can find this libsmb at

More information about the samba-technical mailing list