Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6198:4f6c4aeafafb HEAD
--with-ldap=plugin builds LDAP passdb and userdb support as a plugin.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 07 Aug 2007 00:51:16 +0300 |
parents | a2891c9296ee |
children | c1d09af8bdda |
files | configure.in src/auth/Makefile.am src/auth/db-ldap.c src/auth/passdb.c src/auth/userdb.c |
diffstat | 5 files changed, 64 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 + 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 @@ 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 @@ 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
--- 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 +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 @@ -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 @@ $(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 @@ 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 @@ 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 @@ 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 @@ 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)
--- 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 @@ pool_unref(conn->pool); } +#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
--- 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 @@ #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
--- 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 @@ #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