]> git.sur5r.net Git - openldap/commitdiff
cleanup rwm overlay; init/destroy session cookie; strip (optional) leading 'rwm-...
authorPierangelo Masarati <ando@openldap.org>
Thu, 18 Mar 2004 19:21:57 +0000 (19:21 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 18 Mar 2004 19:21:57 +0000 (19:21 +0000)
servers/slapd/overlays/rwm.c

index 395668961c7e85a99a0627f978dffc08fad73ddc..28616c1accc45d5782bed6ae4aa7a6586fc50b59 100644 (file)
@@ -157,9 +157,13 @@ static int
 rwm_bind( Operation *op, SlapReply *rs )
 {
        slap_overinst           *on = (slap_overinst *) op->o_bd->bd_info;
+       struct ldaprwmap        *rwmap = 
+                       (struct ldaprwmap *)on->on_bi.bi_private;
        int                     rc;
 
 #ifdef ENABLE_REWRITE
+       ( void )rewrite_session_init( rwmap->rwm_rw, op->o_conn );
+
        rc = rwm_op_dn_massage( op, rs, "bindDn" );
 #else
        rc = 1;
@@ -174,6 +178,20 @@ rwm_bind( Operation *op, SlapReply *rs )
        return SLAP_CB_CONTINUE;
 }
 
+static int
+rwm_unbind( Operation *op, SlapReply *rs )
+{
+       slap_overinst           *on = (slap_overinst *) op->o_bd->bd_info;
+       struct ldaprwmap        *rwmap = 
+                       (struct ldaprwmap *)on->on_bi.bi_private;
+
+#ifdef ENABLE_REWRITE
+       rewrite_session_delete( rwmap->rwm_rw, op->o_conn );
+#endif
+
+       return SLAP_CB_CONTINUE;
+}
+
 static int
 rwm_compare( Operation *op, SlapReply *rs )
 {
@@ -638,8 +656,14 @@ rwm_config(
 )
 {
        int             rc = 0;
+       char            *argv0 = NULL;
 
-       if ( strncasecmp( argv[0], "rewrite", sizeof("rewrite") - 1) == 0 ) {
+       if ( strncasecmp( argv[ 0 ], "rwm-", sizeof( "rwm-" ) - 1 ) == 0 ) {
+               argv0 = argv[ 0 ];
+               argv[ 0 ] = &argv0[ sizeof( "rwm-" ) - 1 ];
+       }
+
+       if ( strncasecmp( argv[0], "rewrite", sizeof("rewrite") - 1 ) == 0 ) {
                rc = rwm_rw_config( be, fname, lineno, argc, argv );
 
        } else if (strcasecmp( argv[0], "map" ) == 0 ) {
@@ -652,6 +676,10 @@ rwm_config(
                rc = SLAP_CONF_UNKNOWN;
        }
 
+       if ( argv0 ) {
+               argv[ 0 ] = argv0;
+       }
+
        return rc;
 }
 
@@ -750,6 +778,7 @@ rwm_init(void)
        rwm.on_bi.bi_op_modrdn = rwm_modrdn;
        rwm.on_bi.bi_op_add = rwm_add;
        rwm.on_bi.bi_op_delete = rwm_delete;
+       rwm.on_bi.bi_op_unbind = rwm_unbind;
        rwm.on_bi.bi_extended = rwm_extended;
 
        rwm.on_response = rwm_response;