[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Writing my own backend

> Hi OpenLDAP gurus,
> I'm thinking about development of custom OpenLDAP backend and looking
> for your advice where to start. Is there any document/case study that
> explains how new backend can be integrated to the system, any clues?

Copy from an existing backend; make it dynamic and load it via moduleload,
so you won't even need to touch existing code.
The essential is the module_init() function that registers your backend in
the backend list.  Essentially, you need to provide a BackendInfo
structure filled with all the hooks you backend is willing to provide; i
mean: the bi_init, bi_open, ..., bi_db_init, bi_db_config, bi_db_open, ...
bi_add, bi_delete, ... and so.  You can (safely?) leave NULL those that
you do not intend to implement (I guess if some are not defined your
backend is not going to be much useful ;).
The calling convention for the operation-related hooks is uniform, and it
looks like (Operation *, SlapReply *).  The first structure contains  data
about the operation, the second brings back the results.  You need to
carefully read and understand the structures in slap.h to be able to use
the members of both structures.
A good example is provided by existing backends.  I would suggest
back-ldap because it's perhaps the one I'm most familiar with, and because
its code is (or at least used to be) really straightforward.

One (humble) suggestion: do you really need your own backend?  If all you
need is a proof of concept, perhaps back-perl (if you know perl) or
back-shell can be an option; if all you need is a small bit of
functionality on top of an existing backend, look at overlays
(servers/slapd/overlays/slapover.txt) or SLAPI (google).


Pierangelo Masarati

    SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497