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

Re: slapd - backend

Implementing backends is basically done by example.  Pick
the most similiar existing backend, copy, and hack.

Of course, there are alternative to writing a new backend.
You can use one of the "scripting" backends (tcl, perl, shell).
Also, one can write LDBM wrappers to use some "new" database

At 02:41 PM 1/3/00 +0100, Mikael wrote:
>I have downloaded OpenLDAP2.0-alpha ,installed and compiled it
>successfully on WinNT4.
>Everything seems to work properly when creating, modifying, searching
>e.t.c. in my directory using Berkeley DB as backend. But now I need to
>change this backend to another database using the backend-script
>provided in "slapd and slurpd administrators guide" (ch. 12).

Do you mean back-shell as in "database shell" (as the guide doesn't
refer to any of the newer "scripting" backends such as back-tcl or
back-perl).  With the shell backend, you just plug in programs per
the old U-Mich guide.  There is an example shell programs in

>I created a new directory in servers/slapd/   called  /back-tlwc/ and
>copied everything from another backend folder (/back-tcl/) to this new

Ah, you want to implement a new backend...

>I changed all function(file) names to tlwc_bind.c ,
>tlwc_search.c e.t.c.
>I finally declared the functions in 'slapd/backend.c':
>    #ifdef SLAPD_TLWC
>    #include "back-tlwc/external.h"
>    #endif
>and added the same functions as in the tcl-package(with new function
>names) in external.h.
>I  havent actually written any new stuff in the tlwc-package files
>created above yet.
>I do have some questions thou:
>1. It is told that I must edit the slapd/backend.c file and include
>declarations e.t.c. about my new functions.

For statically linked backends, yes. You must edit slapd/backend.c
and add an entry to the binfo[] array.  The entry contains the
backend name and a pointer to the backend's initializer.

>But the slapd/backend.c is
>NOT included in the complete workspace, i.e. the file cannot be found
>anywhere in the openLdap project.

>The file is there (in
>/slapd/backend.c) but is not used.

It's used.

>How can this be possible?

See the libslapd project.

>Does the backend, using Berkeley DB, not use this file to find the
>correct backend functions?

backend.c is part of the frontend.  It manages the overall
backend infrastructure within the frontend.

>Should I (now) include this file together with my new backend functions
>in a new project? How should(must) I link this to openldap?

No.  You should make the slapd project depend on your backend project.

>2. Exactly where does the structures 'appear' after the frontend has
>received and interpreted an incoming ldap_search or similar? I would
>like to get hold of the entry information, i.e. the operation, the base,
>the scope, filter and attributes e.t.c. but where do these appear?

Yes, the parameters of the LDAP operation are parsed into variables
which are passed to the backend for processing.

>3. Does openLDAP use my new functions (after I have managed to define
>that this new backend should be used, see question below) directly?
>    the frontend receives an incoming search operation, interpret the
>TCP string with BER/DER handle authorization(?) and finally call my new
>'tlwc_search.c' function automatically(with all needed information as

The frontend, after parsing the LDAP message and doing common
checks, determines which backend should handle the operation (based
solely on suffixes of databases) and then, assuming the backend
has provided the appropriate routine, calls the routine with
approriate parameters to perform the operation.

>4. I guess I have to define stuff in the slapd.conf file( or other
>config files) to be able to use this new DB backend but where should I
>make the changes?

Once properly implemented, you would use back-tlwc by configuring
slapd with "database tlwc".

>According to "slapd and slurpd admin..." one should

Take the guide with a grain a salt...  OpenLDAP-devel is quite a bit
different than U-Mich LDAP 3.3.

>make the exact DB changes in Make-common file(the SLAPD_BACKEND
>variable), but this file cannot be found in the package so I assume that
>it has been integrated in the workspace...but where???

For MSVC, you edit portable.nt.

>As I have indicated above I would like to get hold of all the incoming
>information for bind, search, modify e.t.c. ..... work with this
>information towards the new database.....and finally return the result
>to the openLDAP frontend which should handle the ldapResult(with BER/DER
>These are really NT4 based questions but I assume that other openLDAP
>packages look just about the same.


>Really greatful for any help.

Kurt D. Zeilenga		<kurt@boolean.net>
Net Boolean Incorporated	<http://www.boolean.net/>