]> git.sur5r.net Git - openldap/commitdiff
add support for connection_init/destroy and retcode overlay
authorPierangelo Masarati <ando@openldap.org>
Sun, 19 Jun 2005 22:42:12 +0000 (22:42 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 19 Jun 2005 22:42:12 +0000 (22:42 +0000)
servers/slapd/overlays/Makefile.in
servers/slapd/overlays/overlays.c
servers/slapd/overlays/rwm.c

index bd356d0c5f521ead71f028843f2a51571bbe1c4a..8318ad7ae68387e25c7d2914159f48b8a87863e6 100644 (file)
@@ -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
        
index e83bf7a152ee396459a7125b01f4088e7a383fd8..6c3b81ad09cda529d48f19d87c76f1d52506155b 100644 (file)
@@ -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
index c1babcfb20c4fea2097a30cf81ecaae4a5e9e321..e485b063480f7c6e804086aa69c7f4231279f181 100644 (file)
@@ -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 );