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

Re: access to schema info from backend

David Parker writes:

> I am starting to look at developing a custom back-end to run with
> OpenLDAP.  I gather that back-passwd is a good simple model to use as
> an example for how this is done.

Sure, it's as good as any.  There is one detail which back-passwd won't
tell you: The bind operation is a bit special.  If your backend has a
bind operation, bind it should do send_ldap_result() only if the result
code is _not_ LDAP_SUCCESS.

> I understand that the list archives are the best place to get more
> information on this, and I have started searching through them, but if
> anybody recalls a good thread on introductory back-end development, I
> would appreciate a pointer to it.

People don't write new backends often, so I don't think it has been
discussed much.  Here is a brief summary:

Update the following files with info about the backend:
  configure.in, include/portable.h.in, include/portable.nt,
  servers/slapd/backend.c to call it,
  servers/slapd/back-<backend-name>/*.* with the code,
  doc/man/man5/slapd-<backend-name>.5 with documentation,
  doc/man/man5/slapd.conf.5 to refer to the documentation.
In most files you can copy what is done with anything about 'PASSWD'
and 'passwd'.

Then use the version of autoconf in ftp://ftp.openldap.org/pub/tools/ to
build configure from your updated configure.in.

See the other slapd-*.5's for how to structure the documentation.  If
you don't know man format (nroff), write the it in text format,
preferably mimicking the structure you see in e.g. 'man slapd-passwd',
and ask if someone on the openldap-devel mailinglist will convert it to
man format for you.

You can discuss the backend development on the openldap-devel
mailinglist.  If you think others may have use for it, please submit it
via ITS <http://www.openldap.org/its/> when it is finished.  Do not
expect anyone to pick up patches that are only posted to the mailinglist
and not to ITS.  See <http://www.OpenLDAP.org/devel/contributing.html>
for further details on how to contribute to OpenLDAP.

Note that the calling conventions for backends (i.e. backend prototypes
and some data structures) have changed between OpenLDAP 2.1 and the
development (cvs HEAD) branch of OpenLDAP.  If you intend to submit your
backend for inclusion in OpenLDAP, it should be written for HEAD, but if
you want to use it soon with a stable OpenLDAP, you'll need to write it
for OpenLDAP 2.1.  So you may have to write it for both.

> A specific question: my backend will likely need access to schema
> information, that is, whatever schema has been defined for the current
> server via the slapd.conf file. Is there an api somewhere in the
> server code that would give me access to the loaded schema data?

There is no particular dedicated API, just some functions in slapd which
you get with `#include "slap.h"'.  These include functions from:
  oc.c  - object classes
  ad.c  - attribute descriptions
  at.c  - attribute types
  mr.c  - matching rules
  mra.c - extensible matching rule assertions
  schema_check.c - various
It would be really nice if someone documented them:-)
For now, the code is the documentation.  When that's not enough, ask.