The Shoes of the Fisherman's Wife Are Some Jive-Ass Slippers

tpot (at) frungy . org

rss

2008
Months
Jan
Aug Sep
Oct Nov Dec

Sun, 06 Jan 2008

Getting Started with smbpython

After many false starts, Samba is starting to acquire some client-side scripting support. The language being used is Python, although Swig is being used to generate bindings. At a later stage perhaps other scripting languages might be supported.

At the moment the Python bindings are in their infancy, but it's still possible to do some useful things. To start hacking on the Samba Python bindings check out a copy of the source from Subversion and build as per usual:

$ svn co svn://svn.samba.org/samba/branches/SAMBA_4_0
[...stuff...]
$ cd SAMBA_4_0/source
$ ./autogen.sh && ./configure.developer && make
[...more stuff...]
Now these commands will build a complete Samba environment including the Python bindings. For the moment we will be working directly out of the build directory and not bother installing libraries, executables, etc. The only tweak we need to do is to set LD_LIBRARY_PATH to point at the shared libraries we have just built and then run a Python executable with all the Samba goodies compiled in:
$ export LD_LIBRARY_PATH=`pwd`/bin/shared
$ bin/smbpython
Python 2.5.1 (r251:54863, Oct  5 2007, 13:38:40) 
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
What can we do from here? I'm hoping to write some more entries about some of the existing Python bindings, starting with tdb and ldb.

Thanks to Jelmer Vernooij for taking my bits and pieces of decrepit Swig bindings and turning it into something useful.

posted at: 21:30 | path: /software/samba | permanent link to this entry