From: Pierangelo Masarati Date: Sun, 19 Jun 2005 22:42:12 +0000 (+0000) Subject: add support for connection_init/destroy and retcode overlay X-Git-Tag: OPENLDAP_AC_BP~507 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fddeed79031492bed305e8629185a04b15013a55;p=openldap add support for connection_init/destroy and retcode overlay --- diff --git a/servers/slapd/overlays/Makefile.in b/servers/slapd/overlays/Makefile.in index bd356d0c5f..8318ad7ae6 100644 --- a/servers/slapd/overlays/Makefile.in +++ b/servers/slapd/overlays/Makefile.in @@ -23,6 +23,7 @@ SRCS = overlays.c \ pcache.c \ ppolicy.c \ refint.c \ + retcode.c \ rwm.c rwmconf.c rwmdn.c rwmmap.c \ syncprov.c \ translucent.c \ @@ -77,6 +78,9 @@ ppolicy.la : ppolicy.lo refint.la : refint.lo $(LTLINK_MOD) -module -o $@ refint.lo version.lo $(LINK_LIBS) +retcode.la : retcode.lo + $(LTLINK_MOD) -module -o $@ retcode.lo version.lo $(LINK_LIBS) + rwm_x.o: rwm.o rwmconf.o rwmdn.o rwmmap.o $(LD) -r -o $@ rwm.o rwmconf.o rwmdn.o rwmmap.o diff --git a/servers/slapd/overlays/overlays.c b/servers/slapd/overlays/overlays.c index e83bf7a152..6c3b81ad09 100644 --- a/servers/slapd/overlays/overlays.c +++ b/servers/slapd/overlays/overlays.c @@ -47,6 +47,9 @@ extern int pcache_init(); #if SLAPD_OVER_REFINT == SLAPD_MOD_STATIC extern int refint_init(); #endif +#if SLAPD_OVER_RETCODE == SLAPD_MOD_STATIC +extern int retcode_init(); +#endif #if SLAPD_OVER_RWM == SLAPD_MOD_STATIC extern int rwm_init(); #endif @@ -88,6 +91,9 @@ static struct { #if SLAPD_OVER_REFINT == SLAPD_MOD_STATIC { "Referential Integrity", refint_init }, #endif +#if SLAPD_OVER_RETCODE == SLAPD_MOD_STATIC + { "Return Code", retcode_init }, +#endif #if SLAPD_OVER_RWM == SLAPD_MOD_STATIC { "Rewrite/Remap", rwm_init }, #endif diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index c1babcfb20..e485b06348 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -228,6 +228,32 @@ cleanup_attr:; return SLAP_CB_CONTINUE; } +#ifdef ENABLE_REWRITE +static int +rwm_conn_init( BackendDB *be, Connection *conn ) +{ + slap_overinst *on = (slap_overinst *) be->bd_info; + struct ldaprwmap *rwmap = + (struct ldaprwmap *)on->on_bi.bi_private; + + ( void )rewrite_session_init( rwmap->rwm_rw, conn ); + + return SLAP_CB_CONTINUE; +} + +static int +rwm_conn_destroy( BackendDB *be, Connection *conn ) +{ + slap_overinst *on = (slap_overinst *) be->bd_info; + struct ldaprwmap *rwmap = + (struct ldaprwmap *)on->on_bi.bi_private; + + ( void )rewrite_session_delete( rwmap->rwm_rw, conn ); + + return SLAP_CB_CONTINUE; +} +#endif /* ENABLE_REWRITE */ + static int rwm_op_bind( Operation *op, SlapReply *rs ) { @@ -237,9 +263,6 @@ rwm_op_bind( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - ( void )rewrite_session_delete( rwmap->rwm_rw, op->o_conn ); - ( void )rewrite_session_init( rwmap->rwm_rw, op->o_conn ); - rc = rwm_op_dn_massage( op, rs, "bindDN" ); #else /* ! ENABLE_REWRITE */ rc = 1; @@ -1495,6 +1518,11 @@ rwm_init(void) rwm.on_bi.bi_operational = rwm_operational; rwm.on_bi.bi_chk_referrals = 0 /* rwm_chk_referrals */ ; +#ifdef ENABLE_REWRITE + rwm.on_bi.bi_connection_init = rwm_conn_init; + rwm.on_bi.bi_connection_destroy = rwm_conn_destroy; +#endif /* ENABLE_REWRITE */ + rwm.on_response = rwm_response; return overlay_register( &rwm );