mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
add support for connection_init/destroy and retcode overlay
This commit is contained in:
parent
9f2faed566
commit
fddeed7903
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user