mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-03 20:40:05 -05:00
Merged dynamic module support patch (see ITS #196). To enable, run ./configure w
ith --enable-modules. GLib v1.2 or higher is required.
This commit is contained in:
parent
e2b5b21155
commit
5a470f8959
24 changed files with 1680 additions and 905 deletions
21
acconfig.h
21
acconfig.h
|
|
@ -196,6 +196,9 @@
|
|||
/* define this to use SLAPD Berkeley DB2 backend */
|
||||
#undef SLAPD_BDB2
|
||||
|
||||
/* define this to compile SLAPD DB2 backend as a dynamic module*/
|
||||
#undef SLAPD_BDB2_DYNAMIC
|
||||
|
||||
/* define this for ClearText password support */
|
||||
#undef SLAPD_CLEARTEXT
|
||||
|
||||
|
|
@ -205,18 +208,30 @@
|
|||
/* define this to use SLAPD LDAP backend */
|
||||
#undef SLAPD_LDAP
|
||||
|
||||
/* define this to compile SLAPD LDAP backend as a dynamic module*/
|
||||
#undef SLAPD_LDAP_DYNAMIC
|
||||
|
||||
/* define this to use SLAPD LDBM backend */
|
||||
#undef SLAPD_LDBM
|
||||
|
||||
/* define this to compile SLAPD LDBM backend as a dynamic module*/
|
||||
#undef SLAPD_LDBM_DYNAMIC
|
||||
|
||||
/* define this to use SLAPD Modules */
|
||||
#undef SLAPD_MODULES
|
||||
|
||||
/* define this to use SLAPD passwd backend */
|
||||
#undef SLAPD_PASSWD
|
||||
|
||||
/* define this to compile SLAPD passwd backend as a dynamic module*/
|
||||
#undef SLAPD_PASSWD_DYNAMIC
|
||||
|
||||
/* define this to use SLAPD Perl backend */
|
||||
#undef SLAPD_PERL
|
||||
|
||||
/* define this to compile SLAPD Perl backend as a dynamic module*/
|
||||
#undef SLAPD_PERL_DYNAMIC
|
||||
|
||||
/* define this for phonetic support */
|
||||
#undef SLAPD_PHONETIC
|
||||
|
||||
|
|
@ -226,9 +241,15 @@
|
|||
/* define this to use SLAPD shell backend */
|
||||
#undef SLAPD_SHELL
|
||||
|
||||
/* define this to compile SLAPD shell backend as a dynamic module*/
|
||||
#undef SLAPD_SHELL_DYNAMIC
|
||||
|
||||
/* define this to use SLAPD TCL backend */
|
||||
#undef SLAPD_TCL
|
||||
|
||||
/* define this to compile SLAPD TCL backend as a dynamic module*/
|
||||
#undef SLAPD_TCL_DYNAMIC
|
||||
|
||||
/* define this to be empty if your compiler doesn't support volatile */
|
||||
#undef volatile
|
||||
|
||||
|
|
|
|||
99
configure.in
99
configure.in
|
|
@ -103,17 +103,31 @@ OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dn
|
|||
|
||||
dnl SLAPD Backend options
|
||||
OL_ARG_ENABLE(bdb2,[ --enable-bdb2 enable bdb2 backend], no)dnl
|
||||
OL_ARG_WITH(bdb2_module,[ --with-bdb2-module module type], static,
|
||||
[static dynamic])
|
||||
OL_ARG_ENABLE(ldap,[ --enable-ldap enable ldap backend], no)dnl
|
||||
OL_ARG_WITH(ldap_module,[ --with-ldap-module module type], static,
|
||||
[static dynamic])
|
||||
OL_ARG_ENABLE(ldbm,[ --enable-ldbm enable ldbm backend], yes)dnl
|
||||
OL_ARG_WITH(ldbm_module,[ --with-ldbm-module module type], static,
|
||||
[static dynamic])
|
||||
OL_ARG_WITH(ldbm_api,[ --with-ldbm-api use LDBM API], auto,
|
||||
[auto db2 db mdbm gdbm ndbm manual])
|
||||
OL_ARG_WITH(ldbm_type,[ --with-ldbm-type use LDBM type], auto,
|
||||
[auto btree hash])
|
||||
|
||||
OL_ARG_ENABLE(passwd,[ --enable-passwd enable passwd backend], no)dnl
|
||||
OL_ARG_WITH(passwd_module,[ --with-passwd-module module type], static,
|
||||
[static dynamic])
|
||||
OL_ARG_ENABLE(perl,[ --enable-perl enable perl backend], no)dnl
|
||||
OL_ARG_WITH(perl_module,[ --with-perl-module module type], static,
|
||||
[static dynamic])
|
||||
OL_ARG_ENABLE(shell,[ --enable-shell enable shell backend], no)dnl
|
||||
OL_ARG_WITH(shell_module,[ --with-shell-module module type], static,
|
||||
[static dynamic])
|
||||
OL_ARG_ENABLE(tcl,[ --enable-tcl enable tcl backend], no)dnl
|
||||
OL_ARG_WITH(tcl_module,[ --with-tcl-module module type], static,
|
||||
[static dynamic])
|
||||
|
||||
dnl SLURPD OPTIONS
|
||||
AC_ARG_WITH(xxslurpdoptions,[SLURPD Options:])
|
||||
|
|
@ -180,6 +194,27 @@ if test $ol_enable_slapd = no ; then
|
|||
if test $ol_with_ldbm_type != auto ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-type argument])
|
||||
fi
|
||||
if test $ol_with_bdb2_module != static ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --with-bdb2-module argument])
|
||||
fi
|
||||
if test $ol_with_ldap_module != static ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --with-ldap-module argument])
|
||||
fi
|
||||
if test $ol_with_ldbm_module != static ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-module argument])
|
||||
fi
|
||||
if test $ol_with_passwd_module != static ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --with-passwd-module argument])
|
||||
fi
|
||||
if test $ol_with_perl_module != static ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --with-perl-module argument])
|
||||
fi
|
||||
if test $ol_with_shell_module != static ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --with-shell-module argument])
|
||||
fi
|
||||
if test $ol_with_tcl_module != static ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --with-tcl-module argument])
|
||||
fi
|
||||
if test $ol_enable_slurpd = yes ; then
|
||||
AC_MSG_ERROR([slurpd requires slapd])
|
||||
fi
|
||||
|
|
@ -202,6 +237,14 @@ if test $ol_enable_slapd = no ; then
|
|||
ol_with_ldbm_api=no
|
||||
ol_with_ldbm_type=no
|
||||
|
||||
ol_with_bdb2_module=static
|
||||
ol_with_ldap_module=static
|
||||
ol_with_ldbm_module=static
|
||||
ol_with_passwd_module=static
|
||||
ol_with_perl_module=static
|
||||
ol_with_shell_module=static
|
||||
ol_with_tcl_module=static
|
||||
|
||||
ol_enable_slurpd=no
|
||||
|
||||
elif test $ol_enable_ldbm = no ; then
|
||||
|
|
@ -215,6 +258,10 @@ elif test $ol_enable_ldbm = no ; then
|
|||
AC_MSG_WARN([LDBM disabled, ignoring --with-ldbm-type argument])
|
||||
fi
|
||||
|
||||
if test $ol_with_ldbm_module != static ; then
|
||||
AC_MSG_WARN([LDBM disabled, ignoring --with-ldbm-module argument])
|
||||
fi
|
||||
|
||||
if test $ol_enable_bdb2 = yes ; then
|
||||
AC_MSG_ERROR([BDB2 requires --enable-ldbm])
|
||||
fi
|
||||
|
|
@ -230,6 +277,7 @@ elif test $ol_enable_ldbm = no ; then
|
|||
|
||||
ol_with_ldbm_api=no
|
||||
ol_with_ldbm_type=no
|
||||
ol_with_ldbm_module=static
|
||||
|
||||
elif test $ol_enable_bdb2 = yes ; then
|
||||
dnl SLAPD with BDB2
|
||||
|
|
@ -298,6 +346,14 @@ BUILD_SHELL=no
|
|||
BUILD_TCL=no
|
||||
BUILD_THREAD=no
|
||||
|
||||
BUILD_BDB2_DYNAMIC=no
|
||||
BUILD_LDAP_DYNAMIC=no
|
||||
BUILD_LDBM_DYNAMIC=no
|
||||
BUILD_PASSWD_DYNAMIC=no
|
||||
BUILD_PERL_DYNAMIC=no
|
||||
BUILD_SHELL_DYNAMIC=no
|
||||
BUILD_TCL_DYNAMIC=no
|
||||
|
||||
SLAPD_MODULES_LDFLAGS=
|
||||
SLAPD_MODULES_CPPFLAGS=
|
||||
|
||||
|
|
@ -396,6 +452,14 @@ if test $ol_enable_modules != no ; then
|
|||
dnl should check glib version
|
||||
ol_link_modules=yes
|
||||
fi
|
||||
else
|
||||
ol_with_bdb2_module=static
|
||||
ol_with_ldap_module=static
|
||||
ol_with_ldbm_module=static
|
||||
ol_with_passwd_module=static
|
||||
ol_with_perl_module=static
|
||||
ol_with_shell_module=static
|
||||
ol_with_tcl_module=static
|
||||
fi
|
||||
|
||||
ol_link_perl=no
|
||||
|
|
@ -1765,42 +1829,70 @@ if test "$ol_link_bdb2" != no ; then
|
|||
AC_DEFINE(SLAPD_BDB2,1)
|
||||
BUILD_SLAPD=yes
|
||||
BUILD_BDB2=yes
|
||||
if test "$ol_with_bdb2_module" != static ; then
|
||||
AC_DEFINE(SLAPD_BDB2_DYNAMIC,1)
|
||||
BUILD_BDB2_DYNAMIC=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ol_enable_ldap" != no ; then
|
||||
AC_DEFINE(SLAPD_LDAP,1)
|
||||
BUILD_SLAPD=yes
|
||||
BUILD_LDAP=yes
|
||||
if test "$ol_with_ldap_module" != static ; then
|
||||
AC_DEFINE(SLAPD_LDAP_DYNAMIC,1)
|
||||
BUILD_LDAP_DYNAMIC=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ol_link_ldbm" != no ; then
|
||||
AC_DEFINE(SLAPD_LDBM,1)
|
||||
BUILD_SLAPD=yes
|
||||
BUILD_LDBM=yes
|
||||
if test "$ol_with_ldbm_module" != static ; then
|
||||
AC_DEFINE(SLAPD_LDBM_DYNAMIC,1)
|
||||
BUILD_LDBM_DYNAMIC=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ol_enable_passwd" != no ; then
|
||||
AC_DEFINE(SLAPD_PASSWD,1)
|
||||
BUILD_SLAPD=yes
|
||||
BUILD_PASSWD=yes
|
||||
if test "$ol_with_passwd_module" != static ; then
|
||||
AC_DEFINE(SLAPD_PASSWD_DYNAMIC,1)
|
||||
BUILD_PASSWD_DYNAMIC=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ol_link_perl" != no ; then
|
||||
AC_DEFINE(SLAPD_PERL,1)
|
||||
BUILD_SLAPD=yes
|
||||
BUILD_PERL=yes
|
||||
if test "$ol_with_perl_module" != static ; then
|
||||
AC_DEFINE(SLAPD_PERL_DYNAMIC,1)
|
||||
BUILD_PERL_DYNAMIC=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ol_enable_shell" != no ; then
|
||||
AC_DEFINE(SLAPD_SHELL,1)
|
||||
BUILD_SLAPD=yes
|
||||
BUILD_SHELL=yes
|
||||
if test "$ol_with_shell_module" != static ; then
|
||||
AC_DEFINE(SLAPD_SHELL_DYNAMIC,1)
|
||||
BUILD_SHELL_DYNAMIC=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ol_enable_tcl" != no ; then
|
||||
AC_DEFINE(SLAPD_TCL,1)
|
||||
BUILD_SLAPD=yes
|
||||
BUILD_TCL=yes
|
||||
if test "$ol_with_tcl_module" != static; then
|
||||
AC_DEFINE(SLAPD_TCL_DYNAMIC,1)
|
||||
BUILD_TCL_DYNAMIC=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
|
||||
|
|
@ -1823,6 +1915,13 @@ AC_SUBST(BUILD_SLAPD)
|
|||
AC_SUBST(BUILD_PERL)
|
||||
AC_SUBST(BUILD_SHELL)
|
||||
AC_SUBST(BUILD_TCL)
|
||||
AC_SUBST(BUILD_BDB2_DYNAMIC)
|
||||
AC_SUBST(BUILD_LDAP_DYNAMIC)
|
||||
AC_SUBST(BUILD_LDBM_DYNAMIC)
|
||||
AC_SUBST(BUILD_PASSWD_DYNAMIC)
|
||||
AC_SUBST(BUILD_PERL_DYNAMIC)
|
||||
AC_SUBST(BUILD_SHELL_DYNAMIC)
|
||||
AC_SUBST(BUILD_TCL_DYNAMIC)
|
||||
AC_SUBST(BUILD_SLURPD)
|
||||
|
||||
AC_SUBST(LDAP_LIBS)
|
||||
|
|
|
|||
|
|
@ -170,6 +170,9 @@
|
|||
/* define this to use SLAPD Berkeley DB2 backend */
|
||||
#undef SLAPD_BDB2
|
||||
|
||||
/* define this to compile SLAPD DB2 backend as a dynamic module*/
|
||||
#undef SLAPD_BDB2_DYNAMIC
|
||||
|
||||
/* define this for ClearText password support */
|
||||
#undef SLAPD_CLEARTEXT
|
||||
|
||||
|
|
@ -179,18 +182,30 @@
|
|||
/* define this to use SLAPD LDAP backend */
|
||||
#undef SLAPD_LDAP
|
||||
|
||||
/* define this to compile SLAPD LDAP backend as a dynamic module*/
|
||||
#undef SLAPD_LDAP_DYNAMIC
|
||||
|
||||
/* define this to use SLAPD LDBM backend */
|
||||
#undef SLAPD_LDBM
|
||||
|
||||
/* define this to compile SLAPD LDBM backend as a dynamic module*/
|
||||
#undef SLAPD_LDBM_DYNAMIC
|
||||
|
||||
/* define this to use SLAPD Modules */
|
||||
#undef SLAPD_MODULES
|
||||
|
||||
/* define this to use SLAPD passwd backend */
|
||||
#undef SLAPD_PASSWD
|
||||
|
||||
/* define this to compile SLAPD passwd backend as a dynamic module*/
|
||||
#undef SLAPD_PASSWD_DYNAMIC
|
||||
|
||||
/* define this to use SLAPD Perl backend */
|
||||
#undef SLAPD_PERL
|
||||
|
||||
/* define this to compile SLAPD Perl backend as a dynamic module*/
|
||||
#undef SLAPD_PERL_DYNAMIC
|
||||
|
||||
/* define this for phonetic support */
|
||||
#undef SLAPD_PHONETIC
|
||||
|
||||
|
|
@ -200,9 +215,15 @@
|
|||
/* define this to use SLAPD shell backend */
|
||||
#undef SLAPD_SHELL
|
||||
|
||||
/* define this to compile SLAPD shell backend as a dynamic module*/
|
||||
#undef SLAPD_SHELL_DYNAMIC
|
||||
|
||||
/* define this to use SLAPD TCL backend */
|
||||
#undef SLAPD_TCL
|
||||
|
||||
/* define this to compile SLAPD TCL backend as a dynamic module*/
|
||||
#undef SLAPD_TCL_DYNAMIC
|
||||
|
||||
/* define this to be empty if your compiler doesn't support volatile */
|
||||
#undef volatile
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \
|
|||
phonetic.c acl.c str2filter.c aclparse.c init.c user.c \
|
||||
repl.c lock.c \
|
||||
suffixalias.c schema.c schemaparse.c monitor.c configinfo.c \
|
||||
root_dse.c
|
||||
root_dse.c module.c
|
||||
OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \
|
||||
attr.o entry.o config.o backend.o result.o operation.o \
|
||||
dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o \
|
||||
|
|
@ -19,11 +19,14 @@ OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \
|
|||
phonetic.o acl.o str2filter.o aclparse.o init.o user.o \
|
||||
repl.o lock.o \
|
||||
suffixalias.o schema.o schemaparse.o monitor.o configinfo.o \
|
||||
root_dse.o
|
||||
root_dse.o module.o
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
|
||||
# $(LTHREAD_LIBS) must be last
|
||||
XLIBS = libbackends.a -lavl -lldbm -lldif -lldap_r -llber -llutil
|
||||
XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) \
|
||||
|
|
@ -148,3 +151,14 @@ install-tools: FORCE
|
|||
@-$(MKDIR) $(sbindir)
|
||||
(cd tools; $(MAKE) $(MFLAGS) install)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ BUILD_OPT = "--enable-bdb2"
|
|||
BUILD_SRV = @BUILD_BDB2@
|
||||
|
||||
XINCPATH = -I.. -I$(srcdir)/..
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
|
||||
PROGRAMS = libback-bdb2.a
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,19 @@
|
|||
#include "slap.h"
|
||||
#include "back-bdb2.h"
|
||||
|
||||
#ifdef SLAPD_BDB2_DYNAMIC
|
||||
#include <gmodule.h>
|
||||
|
||||
G_MODULE_EXPORT void init_module(int argc, char *argv[]) {
|
||||
BackendInfo bi;
|
||||
|
||||
bi.bi_type = "bdb2";
|
||||
bi.bi_init = bdb2_back_initialize;
|
||||
|
||||
backend_add(&bi);
|
||||
}
|
||||
|
||||
#endif /* SLAPD_BDB2_DYNAMIC */
|
||||
|
||||
static int
|
||||
bdb2i_back_init_private(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ BUILD_SRV = @BUILD_LDAP@
|
|||
PROGRAMS = libback-ldap.a
|
||||
|
||||
XINCPATH = -I.. -I$(srcdir)/..
|
||||
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
|
||||
all-local-srv: FORCE
|
||||
$(MAKE) $(MFLAGS) libback-ldap.a
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,20 @@
|
|||
#include "slap.h"
|
||||
#include "back-ldap.h"
|
||||
|
||||
#ifdef SLAPD_LDAP_DYNAMIC
|
||||
#include <gmodule.h>
|
||||
|
||||
G_MODULE_EXPORT void init_module(int argc, char *argv[]) {
|
||||
BackendInfo bi;
|
||||
|
||||
bi.bi_type = "ldap";
|
||||
bi.bi_init = ldap_back_initialize;
|
||||
|
||||
backend_add(&bi);
|
||||
}
|
||||
|
||||
#endif /* SLAPD_LDAP_DYNAMIC */
|
||||
|
||||
int
|
||||
ldap_back_initialize(
|
||||
BackendInfo *bi
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ BUILD_OPT = "--enable-ldbm"
|
|||
BUILD_SRV = @BUILD_LDBM@
|
||||
|
||||
XINCPATH = -I.. -I$(srcdir)/..
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
|
||||
PROGRAMS = libback-ldbm.a
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,20 @@
|
|||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
|
||||
#ifdef SLAPD_LDBM_DYNAMIC
|
||||
#include <gmodule.h>
|
||||
|
||||
G_MODULE_EXPORT void init_module(int argc, char *argv[]) {
|
||||
BackendInfo bi;
|
||||
|
||||
bi.bi_type = "ldbm";
|
||||
bi.bi_init = ldbm_back_initialize;
|
||||
|
||||
backend_add(&bi);
|
||||
}
|
||||
|
||||
#endif /* SLAPD_LDBM_DYNAMIC */
|
||||
|
||||
int
|
||||
ldbm_back_initialize(
|
||||
BackendInfo *bi
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ BUILD_SRV = @BUILD_PASSWD@
|
|||
PROGRAMS= libback-passwd.a
|
||||
|
||||
XINCPATH = -I.. -I$(srcdir)/..
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
|
||||
all-local-srv: FORCE
|
||||
$(MAKE) $(MFLAGS) libback-passwd.a
|
||||
|
|
|
|||
|
|
@ -9,6 +9,20 @@
|
|||
#include "slap.h"
|
||||
#include "external.h"
|
||||
|
||||
#ifdef SLAPD_PASSWD_DYNAMIC
|
||||
#include <gmodule.h>
|
||||
|
||||
G_MODULE_EXPORT void init_module(int argc, char *argv[]) {
|
||||
BackendInfo bi;
|
||||
|
||||
bi.bi_type = "passwd";
|
||||
bi.bi_init = passwd_back_initialize;
|
||||
|
||||
backend_add(&bi);
|
||||
}
|
||||
|
||||
#endif /* SLAPD_PASSWD_DYNAMIC */
|
||||
|
||||
int
|
||||
passwd_back_initialize(
|
||||
BackendInfo *bi
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ BUILD_SRV = @BUILD_PERL@
|
|||
PROGRAMS = libback-perl.a
|
||||
|
||||
XINCPATH = -I.. -I$(srcdir)/..
|
||||
XDEFS = $(PERL_CPPFLAGS)
|
||||
XDEFS = $(PERL_CPPFLAGS) $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
|
||||
all-local-srv: FORCE
|
||||
$(MAKE) $(MFLAGS) libback-perl.a
|
||||
|
|
|
|||
|
|
@ -28,6 +28,20 @@
|
|||
PerlInterpreter *perl_interpreter = NULL;
|
||||
ldap_pvt_thread_mutex_t perl_interpreter_mutex;
|
||||
|
||||
#ifdef SLAPD_PERL_DYNAMIC
|
||||
#include <gmodule.h>
|
||||
|
||||
G_MODULE_EXPORT void init_module(int argc, char *argv[]) {
|
||||
BackendInfo bi;
|
||||
|
||||
bi.bi_type = "perl";
|
||||
bi.bi_init = perl_back_initialize;
|
||||
|
||||
backend_add(&bi);
|
||||
}
|
||||
|
||||
#endif /* SLAPD_PERL_DYNAMIC */
|
||||
|
||||
|
||||
/**********************************************************
|
||||
*
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ BUILD_SRV = @BUILD_SHELL@
|
|||
PROGRAMS = libback-shell.a
|
||||
|
||||
XINCPATH = -I.. -I$(srcdir)/..
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
|
||||
all-local-srv: FORCE
|
||||
$(MAKE) $(MFLAGS) libback-shell.a
|
||||
|
|
|
|||
|
|
@ -9,6 +9,20 @@
|
|||
#include "slap.h"
|
||||
#include "shell.h"
|
||||
|
||||
#ifdef SLAPD_SHELL_DYNAMIC
|
||||
#include <gmodule.h>
|
||||
|
||||
G_MODULE_EXPORT void init_module(int argc, char *argv[]) {
|
||||
BackendInfo bi;
|
||||
|
||||
bi.bi_type = "shell";
|
||||
bi.bi_init = shell_back_initialize;
|
||||
|
||||
backend_add(&bi);
|
||||
}
|
||||
|
||||
#endif /* SLAPD_SHELL_DYNAMIC */
|
||||
|
||||
int
|
||||
shell_back_initialize(
|
||||
BackendInfo *bi
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ BUILD_SRV = @BUILD_TCL@
|
|||
|
||||
PROGRAMS = libback-tcl.a
|
||||
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
XINCPATH = -I.. -I$(srcdir)/..
|
||||
|
||||
all-local-srv: FORCE
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* tcl_init.c - tcl backend initialization
|
||||
*
|
||||
* $Id: tcl_init.c,v 1.6 1999/03/03 16:02:10 hallvard Exp $
|
||||
* $Id: tcl_init.c,v 1.7 1999/06/23 10:31:37 bastiaan Exp $
|
||||
*
|
||||
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
|
||||
*
|
||||
|
|
@ -21,6 +21,20 @@
|
|||
|
||||
ldap_pvt_thread_mutex_t tcl_interpreter_mutex;
|
||||
|
||||
#ifdef SLAPD_TCL_DYNAMIC
|
||||
#include <gmodule.h>
|
||||
|
||||
G_MODULE_EXPORT void init_module(int argc, char *argv[]) {
|
||||
BackendInfo bi;
|
||||
|
||||
bi.bi_type = "tcl";
|
||||
bi.bi_init = tcl_back_initialize;
|
||||
|
||||
backend_add(&bi);
|
||||
}
|
||||
|
||||
#endif /* SLAPD_TCL_DYNAMIC */
|
||||
|
||||
int
|
||||
tcl_back_initialize (
|
||||
BackendInfo * bi
|
||||
|
|
|
|||
|
|
@ -36,25 +36,25 @@
|
|||
#endif
|
||||
|
||||
static BackendInfo binfo[] = {
|
||||
#ifdef SLAPD_LDAP
|
||||
#if defined(SLAPD_LDAP) && !defined(SLAPD_LDAP_DYNAMIC)
|
||||
{"ldap", ldap_back_initialize},
|
||||
#endif
|
||||
#ifdef SLAPD_LDBM
|
||||
#if defined(SLAPD_LDBM) && !defined(SLAPD_LDBM_DYNAMIC)
|
||||
{"ldbm", ldbm_back_initialize},
|
||||
#endif
|
||||
#ifdef SLAPD_BDB2
|
||||
#if defined(SLAPD_BDB2) && !defined(SLAPD_BDB2_DYNAMIC)
|
||||
{"bdb2", bdb2_back_initialize},
|
||||
#endif
|
||||
#ifdef SLAPD_PASSWD
|
||||
#if defined(SLAPD_PASSWD) && !defined(SLAPD_PASSWD_DYNAMIC)
|
||||
{"passwd", passwd_back_initialize},
|
||||
#endif
|
||||
#ifdef SLAPD_PERL
|
||||
#if defined(SLAPD_PERL) && !defined(SLAPD_PERL_DYNAMIC)
|
||||
{"perl", perl_back_initialize},
|
||||
#endif
|
||||
#ifdef SLAPD_SHELL
|
||||
#if defined(SLAPD_SHELL) && !defined(SLAPD_SHELL_DYNAMIC)
|
||||
{"shell", shell_back_initialize},
|
||||
#endif
|
||||
#ifdef SLAPD_TCL
|
||||
#if defined(SLAPD_TCL) && !defined(SLAPD_LDAP_TCL)
|
||||
{"tcl", tcl_back_initialize},
|
||||
#endif
|
||||
{NULL}
|
||||
|
|
@ -108,11 +108,48 @@ int backend_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_MODULES
|
||||
return 0;
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"backend_init: failed\n",
|
||||
0, 0, 0 );
|
||||
|
||||
return rc;
|
||||
#endif /* SLAPD_MODULES */
|
||||
}
|
||||
|
||||
int backend_add(BackendInfo *aBackendInfo)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if ((rc = aBackendInfo->bi_init(aBackendInfo)) != 0) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"backend_add: initialization for type \"%s\" failed\n",
|
||||
aBackendInfo->bi_type, 0, 0 );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* now add the backend type to the Backend Info List */
|
||||
{
|
||||
BackendInfo *newBackendInfo = 0;
|
||||
|
||||
/* if backendInfo == binfo no deallocation of old backendInfo */
|
||||
if (backendInfo == binfo) {
|
||||
newBackendInfo = ch_calloc(nBackendInfo + 1, sizeof(BackendInfo));
|
||||
memcpy(newBackendInfo, backendInfo, sizeof(BackendInfo) *
|
||||
nBackendInfo);
|
||||
} else {
|
||||
newBackendInfo = ch_realloc(backendInfo, sizeof(BackendInfo) *
|
||||
(nBackendInfo + 1));
|
||||
}
|
||||
memcpy(&newBackendInfo[nBackendInfo], aBackendInfo,
|
||||
sizeof(BackendInfo));
|
||||
backendInfo = newBackendInfo;
|
||||
nBackendInfo++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int backend_startup(int n)
|
||||
|
|
@ -295,6 +332,15 @@ int backend_destroy(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SLAPD_MODULES
|
||||
if (backendInfo != binfo) {
|
||||
free(backendInfo);
|
||||
}
|
||||
#endif /* SLAPD_MODULES */
|
||||
|
||||
nBackendInfo = 0;
|
||||
backendInfo = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -558,6 +558,23 @@ read_config( char *fname )
|
|||
}
|
||||
ldap_srvtab = ch_strdup( cargv[1] );
|
||||
|
||||
#ifdef SLAPD_MODULES
|
||||
} else if (strcasecmp( cargv[0], "loadmodule") == 0 ) {
|
||||
if ( cargc < 2 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: missing filename in \"loadmodule <filename>\" line\n",
|
||||
fname, lineno, 0 );
|
||||
exit( 1 );
|
||||
}
|
||||
if (!load_module(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: failed to load or initialize module %s\n",
|
||||
fname, lineno, cargv[1]);
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
#endif /*SLAPD_MODULES*/
|
||||
|
||||
/* pass anything else to the current backend info/db config routine */
|
||||
} else {
|
||||
if ( bi != NULL ) {
|
||||
|
|
|
|||
37
servers/slapd/module.c
Normal file
37
servers/slapd/module.c
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "portable.h"
|
||||
#include <stdio.h>
|
||||
#include "slap.h"
|
||||
|
||||
#ifdef SLAPD_MODULES
|
||||
|
||||
#include <glib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
int load_module(const char* file_name, int argc, char *argv[]) {
|
||||
GModule* module = NULL;
|
||||
void (*initialize) LDAP_P((int argc, char *argv[]));
|
||||
|
||||
if (!g_module_supported()) {
|
||||
Debug(LDAP_DEBUG_ANY, "loadable modules not supported on this platform\n", 0, 0, 0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((module = g_module_open(file_name, G_MODULE_BIND_LAZY)) == NULL) {
|
||||
Debug(LDAP_DEBUG_ANY, "failed to load module %s: %s\n", file_name, g_module_error(), 0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Debug(LDAP_DEBUG_CONFIG, "loaded module %s\n", file_name, 0, 0);
|
||||
|
||||
if (g_module_symbol(module, "init_module", (gpointer *) &initialize)) {
|
||||
initialize(argc, argv);
|
||||
} else {
|
||||
Debug(LDAP_DEBUG_CONFIG, "module %s: no init_module() function found\n", file_name, 0, 0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* SLAPD_MODULES */
|
||||
|
||||
|
|
@ -69,6 +69,7 @@ void ava_free LDAP_P(( Ava *ava, int freeit ));
|
|||
*/
|
||||
|
||||
int backend_init LDAP_P((void));
|
||||
int backend_add LDAP_P((BackendInfo *aBackendInfo));
|
||||
int backend_startup LDAP_P((int dbnum));
|
||||
int backend_shutdown LDAP_P((int dbnum));
|
||||
int backend_destroy LDAP_P((void));
|
||||
|
|
@ -198,6 +199,14 @@ int test_filter LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
|
|||
FILE * lock_fopen LDAP_P(( char *fname, char *type, FILE **lfp ));
|
||||
int lock_fclose LDAP_P(( FILE *fp, FILE *lfp ));
|
||||
|
||||
/*
|
||||
* module.c
|
||||
*/
|
||||
|
||||
#ifdef SLAPD_MODULES
|
||||
int load_module LDAP_P(( const char* file_name, int argc, char *argv[] ));
|
||||
#endif /* SLAPD_MODULES */
|
||||
|
||||
/*
|
||||
* monitor.c
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ BUILD_BDB2 = @BUILD_BDB2@
|
|||
LDAP_INCDIR= ../../../include
|
||||
LDAP_LIBDIR= ../../../libraries
|
||||
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
XLDFLAGS = $(MODULES_LDFLAGS)
|
||||
|
||||
XLIBS = -lavl -lldif -lldbm -lldap_r -llber -llutil
|
||||
XXLIBS = $(LDAPD_LIBS) $(SLAPD_LIBS) \
|
||||
$(PERL_LDFLAGS) $(LDBM_LIBS) $(KRB_LIBS) $(LUTIL_LIBS)
|
||||
|
|
@ -44,7 +47,7 @@ EDB2LDIFOBJS = edb2ldif.o ldapsyntax.o
|
|||
|
||||
OBJS2 = mimic.o \
|
||||
../config.o ../ch_malloc.o ../backend.o ../charray.o \
|
||||
../aclparse.o ../schema.o ../filterentry.o \
|
||||
../module.o ../aclparse.o ../schema.o ../filterentry.o \
|
||||
../acl.o ../phonetic.o ../attr.o ../value.o ../entry.o \
|
||||
../dn.o ../filter.o ../str2filter.o ../ava.o ../init.o \
|
||||
../schemaparse.o
|
||||
|
|
|
|||
Loading…
Reference in a new issue