[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
ADDING A NEW SLAPD BACKEND
We have been using the ldap from openldap.org site. Currently we are
using ldbm backend with gdbm. I am trying to add a new SLAPD BACKEND.
Could somebody tell me where I can find some detailed documentation for
adding a new backend. I looked at the SLAPD and SLURPD ADMIN GUIDE 12th
chapter but that's not really enough for building a backend. I tried to
make changes to the /ldap/configure file but I guess there should be an
easy way of doing this. I would like to know if there is any detailed
documentation on adding a backend.
I am trying to add a backend called nags. It's really a backend for
getting data from voice machines ( I get the NAME and GREETING). I
changed the slapd.conf file to have my new back end specifications.
************************************************************************
********************************
/usr/local/etc/openldap/slapd.conf
#######################################################################
# nags database definitions (remote)
#######################################################################
database nags
suffix "o=testnags, c=US"
rootdn "cn=root, o=testnags, c=US"
rootpw nags
#directory of the login file
directory /export/home/ids/snalla/openldap/ldap/usr/tmp
#file name of the file with login passwd information for NAG Server
loginfile nagslogin
************************************************************************
********************************
I created a new directory ldap/servers/slapd/back-nags and added my
files add.c, modify.c, init.c, bind.c, abandon.c, close.c, compare.c,
config.c, delete.c, back-nags.h, proto-back-nags.h and I copied the
Makefile.in from back-ldbm directory and modified it according to my
backend.
************************************************************************
********************************
/servers/slapd/back-nags/Makefile.in
XSRCS = version.c
SRCS = abandon.c \
add.c \
bind.c \
close.c \
compare.c \
config.c \
delete.c \
entry.c \
init.c \
auth.c \
search.c \
modify.c \
unbind.c
OBJS = abandon.o \
add.o \
bind.o \
close.o \
compare.o \
config.o \
delete.o \
entry.o \
init.o \
auth.o \
search.o \
modify.o \
unbind.o
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries
BUILD_OPT = "--enable-nags"
BUILD_SRV = @BUILD_NAGS@
XINCPATH = -I.. -I$(srcdir)/..
PROGRAMS = libback-nags.a
all-local-srv: FORCE
$(MAKE) $(MFLAGS) libback-nags.a
libback-ldbm.a: version.o
$(AR) ruv $@ $(OBJS) version.o
@$(RANLIB) $@
@touch ../.backend
version.c: $(OBJS) $(LDAP_LIBDEPEND)
$(RM) $@
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` \
h=`$(HOSTNAME)` t=`$(DATE)`; \
$(SED) -e "s|%WHEN%|$${t}|" \
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-e "s|%VERSION%|$${v}|" \
< $(srcdir)/Version.c > $@)
************************************************************************
********************************
I also added my backend in the /servers/slapd/backend.c file.
************************************************************************
********************************
/servers/slapd/backend.c
#ifdef SLAPD_NAGS
if ( strcasecmp( type, "nags" ) == 0 ) {
be->be_bind = nags_back_bind;
be->be_unbind = nags_back_unbind;
be->be_search = nags_back_search;
be->be_compare = nags_back_compare;
be->be_modify = nags_back_modify;
be->be_modrdn = nags_back_modrdn;
be->be_add = nags_back_add;
be->be_delete = nags_back_delete;
be->be_abandon = nags_back_abandon;
be->be_config = nags_back_config;
be->be_init = nags_back_init;
be->be_close = nags_back_close;
#ifdef SLAPD_ACLGROUPS
be->be_group = nags_back_group;
#endif
be->be_type = "nags";
foundit = 1;
}
#endif
************************************************************************
*********************************
After all these what are the steps that I should follow for building my
backend and enabling it. I tried an option of modifying the
/ldap/configure file and adding some lines as given below for enabling
my backend and generating makefile in my back-nags directory.
************************************************************************
*********************************
/ldap/configure
# OpenLDAP --enable-nags
# Check whether --enable-nags or --disable-nags was given.
if test "${enable_nags+set}" = set; then
enableval="$enable_nags"
ol_arg=invalid
for ol_val in auto yes no ; do
if test "$enableval" = "$ol_val" ; then
ol_arg="$ol_val"
fi
done
if test "$ol_arg" = "invalid" ; then
{ echo "configure: error: bad value $enableval for
--enable-nags" 1>&2; exit 1; }
fi
ol_enable_nags="$ol_arg"
else
ol_enable_nags="yes"
fi
# end --enable-nags
~
~
if test $ol_enable_slapd = no ; then
if test $ol_enable_ldbm = yes ; then
echo "configure: warning: slapd disabled, ignoring
--enable_ldbm argument" 1>&2
fi
if test $ol_enable_passwd = yes ; then
echo "configure: warning: slapd disabled, ignoring
--enable_passwd argument" 1>&2
fi
if test $ol_enable_shell = yes ; then
echo "configure: warning: slapd disabled, ignoring
--enable_shell argument" 1>&2
fi
if test $ol_enable_nags = yes ; then
echo "configure: warning: slapd disabled, ignoring
--enable_nags argument" 1>&2
fi
if test $ol_enable_aclgroups = yes ; then
echo "configure: warning: slapd disabled, ignoring
--enable_aclgroups argument" 1>&2
fi
~
~
# force settings to no
ol_enable_ldbm=no
ol_enable_shell=no
ol_enable_nags=no
ol_enable_passwd=no
ol_enable_aclgroups=no
ol_enable_wrappers=no
~
~
if test "$ol_enable_nags" != no ; then
cat >> confdefs.h <<\EOF
#define SLAPD_NAGS 1
EOF
BUILD_SLAPD=yes
BUILD_NAGS=yes
fi
~
~
servers/slapd/back-nags/Makefile:build/top.mk:servers/slapd/back-nags/Ma
kefile.in:build/srv.mk \
~
~
************************************************************************
*********************************
Then I tried to configure with "./configure
--prefix=~snalla/openldap/ldap/usr/local --enable-nags=yes
--with-ldbm-api=gdbm --with-threads=lwp" options. The configuration went
fine it generated the Makefile in my back-nags directory. But when I do
a make depend it does not build the files in the back-nags directory it
gives the following lines.
cd back-nags; make depend
run configure with --enable-nags to depend libback-nags.a
I cannot build the files in the back-nags directory. What should I be
doing to build the files in the new back end and enabling that backend.
I don't think changing the configure file is the option. I guess there
should be something simple that we should be doing to add a new backend
and enable it. Could somebody please answer this as soon as possible.
Thanks,
Suneetha R. Nalla
Suneetha.Nalla@ons.octel.com