From 154ae48d69a0cfde9fdeb70ae039c774631e0e42 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sun, 9 Jan 2005 21:26:32 +0000 Subject: [PATCH] put back chain overlay into back-ldap --- servers/slapd/back-ldap/Makefile.in | 4 +- servers/slapd/{overlays => back-ldap}/chain.c | 43 +++++++------------ servers/slapd/back-ldap/init.c | 4 ++ servers/slapd/overlays/Makefile.in | 5 --- servers/slapd/overlays/overlays.c | 6 --- 5 files changed, 22 insertions(+), 40 deletions(-) rename servers/slapd/{overlays => back-ldap}/chain.c (95%) diff --git a/servers/slapd/back-ldap/Makefile.in b/servers/slapd/back-ldap/Makefile.in index 2512bd3c3b..8b05a86db8 100644 --- a/servers/slapd/back-ldap/Makefile.in +++ b/servers/slapd/back-ldap/Makefile.in @@ -14,9 +14,9 @@ ## . SRCS = init.c config.c search.c bind.c unbind.c add.c compare.c \ - delete.c modify.c modrdn.c extended.c + delete.c modify.c modrdn.c extended.c chain.c OBJS = init.lo config.lo search.lo bind.lo unbind.lo add.lo compare.lo \ - delete.lo modify.lo modrdn.lo extended.lo + delete.lo modify.lo modrdn.lo extended.lo chain.lo LDAP_INCDIR= ../../../include LDAP_LIBDIR= ../../../libraries diff --git a/servers/slapd/overlays/chain.c b/servers/slapd/back-ldap/chain.c similarity index 95% rename from servers/slapd/overlays/chain.c rename to servers/slapd/back-ldap/chain.c index bc703da8cb..a580c52ff4 100644 --- a/servers/slapd/overlays/chain.c +++ b/servers/slapd/back-ldap/chain.c @@ -21,17 +21,13 @@ #include "portable.h" -#if defined(SLAPD_LDAP) - -#ifdef SLAPD_OVER_CHAIN - #include #include #include #include "slap.h" -#include "../back-ldap/back-ldap.h" +#include "back-ldap.h" static BackendInfo *lback; @@ -388,7 +384,7 @@ end_of_searchref:; } static int -ldap_chain_config( +ldap_chain_db_config( BackendDB *be, const char *fname, int lineno, @@ -416,7 +412,7 @@ ldap_chain_config( } static int -ldap_chain_init( +ldap_chain_db_init( BackendDB *be ) { @@ -424,6 +420,14 @@ ldap_chain_init( void *private = be->be_private; int rc; + if ( lback == NULL ) { + lback = backend_info( "ldap" ); + + if ( lback == NULL ) { + return -1; + } + } + be->be_private = NULL; rc = lback->bi_db_init( be ); on->on_bi.bi_private = be->be_private; @@ -433,7 +437,7 @@ ldap_chain_init( } static int -ldap_chain_destroy( +ldap_chain_db_destroy( BackendDB *be ) { @@ -451,18 +455,12 @@ ldap_chain_destroy( static slap_overinst ldapchain; int -chain_init() +chain_init( void ) { - lback = backend_info( "ldap" ); - - if ( !lback ) { - return -1; - } - ldapchain.on_bi.bi_type = "chain"; - ldapchain.on_bi.bi_db_init = ldap_chain_init; - ldapchain.on_bi.bi_db_config = ldap_chain_config; - ldapchain.on_bi.bi_db_destroy = ldap_chain_destroy; + ldapchain.on_bi.bi_db_init = ldap_chain_db_init; + ldapchain.on_bi.bi_db_config = ldap_chain_db_config; + ldapchain.on_bi.bi_db_destroy = ldap_chain_db_destroy; /* ... otherwise the underlying backend's function would be called, * likely passing an invalid entry; on the contrary, the requested @@ -483,12 +481,3 @@ chain_init() return overlay_register( &ldapchain ); } -#if SLAPD_OVER_CHAIN == SLAPD_MOD_DYNAMIC -int init_module(int argc, char *argv[]) { - return chain_init(); -} -#endif /* SLAPD_OVER_CHAIN == SLAPD_MOD_DYNAMIC */ - -#endif /* SLAPD_OVER_CHAIN */ - -#endif /* ! defined(SLAPD_LDAP) */ diff --git a/servers/slapd/back-ldap/init.c b/servers/slapd/back-ldap/init.c index f3ebb20da2..90604606f0 100644 --- a/servers/slapd/back-ldap/init.c +++ b/servers/slapd/back-ldap/init.c @@ -70,6 +70,10 @@ ldap_back_initialize( BackendInfo *bi ) bi->bi_connection_init = 0; bi->bi_connection_destroy = ldap_back_conn_destroy; + if ( chain_init( ) ) { + return -1; + } + return 0; } diff --git a/servers/slapd/overlays/Makefile.in b/servers/slapd/overlays/Makefile.in index e40ed9971e..9f95972edc 100644 --- a/servers/slapd/overlays/Makefile.in +++ b/servers/slapd/overlays/Makefile.in @@ -14,7 +14,6 @@ ## . SRCS = overlays.c \ - chain.c \ denyop.c \ dyngroup.c \ glue.c \ @@ -26,7 +25,6 @@ SRCS = overlays.c \ syncprov.c \ unique.c OBJS = overlays.lo \ - chain.lo \ denyop.lo \ dyngroup.lo \ glue.lo \ @@ -53,9 +51,6 @@ PROGRAMS = @SLAPD_DYNAMIC_OVERLAYS@ XINCPATH = -I.. -I$(srcdir)/.. XDEFS = $(MODULES_CPPFLAGS) -chain.la : chain.lo $(@PLAT@_LINK_LIBS) - $(LTLINK_MOD) -module -o $@ chain.lo version.lo $(LINK_LIBS) - denyop.la : denyop.lo $(@PLAT@_LINK_LIBS) $(LTLINK_MOD) -module -o $@ denyop.lo version.lo $(LINK_LIBS) diff --git a/servers/slapd/overlays/overlays.c b/servers/slapd/overlays/overlays.c index 632bff232b..3e73167b20 100644 --- a/servers/slapd/overlays/overlays.c +++ b/servers/slapd/overlays/overlays.c @@ -23,9 +23,6 @@ #include "slap.h" -#if SLAPD_OVER_CHAIN == SLAPD_MOD_STATIC -extern int chain_init(); -#endif #if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC extern int denyop_init(); #endif @@ -61,9 +58,6 @@ static struct { char *name; int (*func)(); } funcs[] = { -#if SLAPD_OVER_CHAIN == SLAPD_MOD_STATIC - { "LDAP Chain Response", chain_init }, -#endif #if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC { "Deny Operation", denyop_init }, #endif -- 2.39.5