dovecot: --with-ldap=plugin builds LDAP passdb and userdb suppor...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Aug 7 01:02:19 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/4f6c4aeafafb
changeset: 6198:4f6c4aeafafb
user: Timo Sirainen <tss at iki.fi>
date: Tue Aug 07 00:51:16 2007 +0300
description:
--with-ldap=plugin builds LDAP passdb and userdb support as a plugin.
diffstat:
5 files changed, 66 insertions(+), 14 deletions(-)
configure.in | 24 ++++++++++++++++++------
src/auth/Makefile.am | 29 ++++++++++++++++++++++++-----
src/auth/db-ldap.c | 23 ++++++++++++++++++++++-
src/auth/passdb.c | 2 +-
src/auth/userdb.c | 2 +-
diffs (198 lines):
diff -r a2891c9296ee -r 4f6c4aeafafb configure.in
--- a/configure.in Tue Aug 07 00:50:23 2007 +0300
+++ b/configure.in Tue Aug 07 00:51:16 2007 +0300
@@ -155,11 +155,15 @@ AC_ARG_WITH(sia,
want_sia=no)
AC_ARG_WITH(ldap,
-[ --with-ldap Build with LDAP support],
+[ --with-ldap=yes|plugin Build with LDAP support],
if test x$withval = xno; then
want_ldap=no
- else
+ elif test x$withval = xplugin; then
want_ldap=yes
+ want_ldap_plugin=yes
+ else
+ want_ldap=yes
+ want_ldap_plugin=no
fi,
want_ldap=no)
@@ -1599,15 +1603,26 @@ if test $want_ldap = yes; then
AC_CHECK_LIB(ldap, ldap_start_tls_s, [
AC_DEFINE(LDAP_HAVE_START_TLS_S,, Define if you have ldap_start_tls_s)
])
- AUTH_LIBS="$AUTH_LIBS -lldap"
+ LDAP_LIBS=-lldap
+ AC_SUBST(LDAP_LIBS)
+ if test $want_ldap_plugin != yes; then
+ AUTH_LIBS="$AUTH_LIBS $LDAP_LIBS"
+ AC_DEFINE(BUILTIN_LDAP,, LDAP support is built in)
+ fi
AC_DEFINE(USERDB_LDAP,, Build with LDAP support)
AC_DEFINE(PASSDB_LDAP,, Build with LDAP support)
userdb="$userdb ldap"
passdb="$passdb ldap"
+ if test $want_ldap_plugin = yes; then
+ have_ldap_plugin=yes
+ userdb="$userdb (plugin)"
+ passdb="$passdb (plugin)"
+ fi
])
])
fi
+AM_CONDITIONAL(LDAP_PLUGIN, test "$have_ldap_plugin" = "yes")
dict_drivers=client
@@ -1816,9 +1831,6 @@ AC_CHECK_FUNC(dlopen, [
if test $have_modules = yes; then
AC_DEFINE(HAVE_MODULES,, Define if you have dynamic module support)
- userdb="$userdb (modules)"
- passdb="$passdb (modules)"
-
AC_SUBST(MODULE_LIBS)
fi
diff -r a2891c9296ee -r 4f6c4aeafafb src/auth/Makefile.am
--- a/src/auth/Makefile.am Tue Aug 07 00:50:23 2007 +0300
+++ b/src/auth/Makefile.am Tue Aug 07 00:51:16 2007 +0300
@@ -1,4 +1,12 @@ noinst_LIBRARIES = libpassword.a
noinst_LIBRARIES = libpassword.a
+auth_moduledir = $(moduledir)/auth
+
+if LDAP_PLUGIN
+LDAP_LIB = libauthdb_ldap.la
+endif
+
+auth_module_LTLIBRARIES = \
+ $(LDAP_LIB)
pkglibexecdir = $(libexecdir)/dovecot
@@ -10,7 +18,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib-settings \
-I$(top_srcdir)/src/lib-ntlm \
-I$(top_srcdir)/src/lib-otp \
- -DAUTH_MODULE_DIR=\""$(moduledir)/auth"\" \
+ -DAUTH_MODULE_DIR=\""$(auth_moduledir)"\" \
-DPKG_LIBEXECDIR=\""$(pkglibexecdir)"\" \
$(AUTH_CFLAGS)
@@ -34,6 +42,12 @@ dovecot_auth_LDADD = \
$(RAND_LIBS) \
$(MODULE_LIBS)
+ldap_sources = db-ldap.c passdb-ldap.c userdb-ldap.c
+
+if ! LDAP_PLUGIN
+builtin_ldap_sources = $(ldap_sources)
+endif
+
dovecot_auth_SOURCES = \
auth.c \
auth-cache.c \
@@ -45,7 +59,6 @@ dovecot_auth_SOURCES = \
auth-stream.c \
auth-worker-client.c \
auth-worker-server.c \
- db-ldap.c \
db-sql.c \
db-passwd-file.c \
main.c \
@@ -69,7 +82,6 @@ dovecot_auth_SOURCES = \
passdb-bsdauth.c \
passdb-cache.c \
passdb-checkpassword.c \
- passdb-ldap.c \
passdb-passwd.c \
passdb-passwd-file.c \
passdb-pam.c \
@@ -79,14 +91,14 @@ dovecot_auth_SOURCES = \
passdb-sql.c \
userdb.c \
userdb-blocking.c \
- userdb-ldap.c \
userdb-nss.c \
userdb-passwd.c \
userdb-passwd-file.c \
userdb-prefetch.c \
userdb-static.c \
userdb-vpopmail.c \
- userdb-sql.c
+ userdb-sql.c \
+ $(builtin_ldap_sources)
headers = \
auth.h \
@@ -117,6 +129,13 @@ headers = \
userdb-blocking.h \
userdb-vpopmail.h
+if LDAP_PLUGIN
+libauthdb_ldap_la_LDFLAGS = -module -avoid-version
+libauthdb_ldap_la_LIBADD = $(LDAP_LIBS)
+libauthdb_ldap_la_CPPFLAGS = $(AM_CPPFLAGS)
+libauthdb_ldap_la_SOURCES = $(ldap_sources)
+endif
+
if INSTALL_HEADERS
pkginc_libdir=$(pkgincludedir)/src/auth
pkginc_lib_HEADERS = $(headers)
diff -r a2891c9296ee -r 4f6c4aeafafb src/auth/db-ldap.c
--- a/src/auth/db-ldap.c Tue Aug 07 00:50:23 2007 +0300
+++ b/src/auth/db-ldap.c Tue Aug 07 00:51:16 2007 +0300
@@ -975,4 +975,25 @@ void db_ldap_unref(struct ldap_connectio
pool_unref(conn->pool);
}
-#endif
+#ifndef BUILTIN_LDAP
+/* Building a plugin */
+extern struct passdb_module_interface passdb_ldap;
+extern struct userdb_module_interface userdb_ldap;
+
+void authdb_ldap_init(void);
+void authdb_ldap_deinit(void);
+
+void authdb_ldap_init(void)
+{
+ passdb_register_module(&passdb_ldap);
+ userdb_register_module(&userdb_ldap);
+
+}
+void authdb_ldap_deinit(void)
+{
+ passdb_unregister_module(&passdb_ldap);
+ userdb_unregister_module(&userdb_ldap);
+}
+#endif
+
+#endif
diff -r a2891c9296ee -r 4f6c4aeafafb src/auth/passdb.c
--- a/src/auth/passdb.c Tue Aug 07 00:50:23 2007 +0300
+++ b/src/auth/passdb.c Tue Aug 07 00:51:16 2007 +0300
@@ -205,7 +205,7 @@ void passdbs_init(void)
#ifdef PASSDB_VPOPMAIL
passdb_register_module(&passdb_vpopmail);
#endif
-#ifdef PASSDB_LDAP
+#if defined(PASSDB_LDAP) && defined(BUILTIN_LDAP)
passdb_register_module(&passdb_ldap);
#endif
#ifdef PASSDB_SQL
diff -r a2891c9296ee -r 4f6c4aeafafb src/auth/userdb.c
--- a/src/auth/userdb.c Tue Aug 07 00:50:23 2007 +0300
+++ b/src/auth/userdb.c Tue Aug 07 00:51:16 2007 +0300
@@ -177,7 +177,7 @@ void userdbs_init(void)
#ifdef USERDB_VPOPMAIL
userdb_register_module(&userdb_vpopmail);
#endif
-#ifdef USERDB_LDAP
+#if defined(USERDB_LDAP) && defined(BUILTIN_LDAP)
userdb_register_module(&userdb_ldap);
#endif
#ifdef USERDB_SQL
More information about the dovecot-cvs
mailing list