]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/distproc.c
allow proxies to filter out search references (ITS#5593)
[openldap] / servers / slapd / back-ldap / distproc.c
index b67cb1d7a2c4c6f0b3a3a14563f735187baf3b8f..93411682436580258e8e3047575041e96fcd70bf 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2006 The OpenLDAP Foundation.
+ * Copyright 2005-2008 The OpenLDAP Foundation.
  * Portions Copyright 2003 Howard Chu.
  * All rights reserved.
  *
@@ -237,7 +237,7 @@ static int ldap_distproc_db_init_common( BackendDB  *be );
 static int ldap_distproc_db_init_one( BackendDB *be );
 #define        ldap_distproc_db_open_one(be)           (lback)->bi_db_open( (be) )
 #define        ldap_distproc_db_close_one(be)          (0)
-#define        ldap_distproc_db_destroy_one(be)        (lback)->bi_db_destroy( (be) )
+#define        ldap_distproc_db_destroy_one(be, ca)    (lback)->bi_db_destroy( (be), (ca) )
 
 static int
 ldap_distproc_parse_ctrl(
@@ -298,7 +298,7 @@ ldap_distproc_operational( Operation *op, SlapReply *rs )
         * database.  This fix is likely to intercept also entries
         * generated by back-perl and so. */
        if ( rs->sr_entry->e_private == NULL ) {
-               return 0;
+               return LDAP_SUCCESS;
        }
 
        return SLAP_CB_CONTINUE;
@@ -447,7 +447,7 @@ distproc_ldadd( CfEntryInfo *p, Entry *e, ConfigArgs *ca )
 
 done:;
        if ( rc != LDAP_SUCCESS ) {
-               (void)ldap_distproc_db_destroy_one( ca->be );
+               (void)ldap_distproc_db_destroy_one( ca->be, NULL );
                ch_free( ca->be );
                ca->be = NULL;
        }
@@ -472,9 +472,9 @@ ldap_distproc_cfadd_apply( void *datum, void *arg )
        struct berval                   bv;
 
        /* FIXME: should not hardcode "olcDatabase" here */
-       bv.bv_len = snprintf( lca->ca->msg, sizeof( lca->ca->msg ),
+       bv.bv_len = snprintf( lca->ca->cr_msg, sizeof( lca->ca->cr_msg ),
                "olcDatabase={%d}%s", lca->count, lback->bi_type );
-       bv.bv_val = lca->ca->msg;
+       bv.bv_val = lca->ca->cr_msg;
 
        lca->ca->be->be_private = (void *)li;
        config_build_entry( lca->op, lca->rs, lca->p->e_private, lca->ca,
@@ -567,7 +567,8 @@ distproc_cfgen( ConfigArgs *c )
 
 static int
 ldap_distproc_db_init(
-       BackendDB *be )
+       BackendDB *be,
+       ConfigReply *cr )
 {
        slap_overinst   *on = (slap_overinst *)be->bd_info;
        ldap_distproc_t *lc = NULL;
@@ -659,7 +660,7 @@ private_destroy:;
 
                                db.bd_info = lback;
                                db.be_private = (void *)lc->lc_cfg_li;
-                               ldap_distproc_db_destroy_one( &db );
+                               ldap_distproc_db_destroy_one( &db, NULL );
                                lc->lc_cfg_li = NULL;
 
                        } else {
@@ -712,7 +713,7 @@ ldap_distproc_db_apply( void *datum, void *arg )
 
        lca->be->be_private = (void *)li;
 
-       return lca->func( lca->be );
+       return lca->func( lca->be, NULL );
 }
 
 static int
@@ -735,7 +736,7 @@ ldap_distproc_db_func(
                        db.bd_info = lback;
                        db.be_private = lc->lc_common_li;
 
-                       rc = func( &db );
+                       rc = func( &db, NULL );
 
                        if ( rc != 0 ) {
                                return rc;
@@ -759,21 +760,24 @@ ldap_distproc_db_func(
 
 static int
 ldap_distproc_db_open(
-       BackendDB       *be )
+       BackendDB       *be,
+       ConfigReply     *cr )
 {
        return ldap_distproc_db_func( be, db_open );
 }
 
 static int
 ldap_distproc_db_close(
-       BackendDB       *be )
+       BackendDB       *be,
+       ConfigReply     *cr )
 {
        return ldap_distproc_db_func( be, db_close );
 }
 
 static int
 ldap_distproc_db_destroy(
-       BackendDB       *be )
+       BackendDB       *be,
+       ConfigReply     *cr )
 {
        slap_overinst   *on = (slap_overinst *) be->bd_info;
        ldap_distproc_t *lc = (ldap_distproc_t *)on->on_bi.bi_private;
@@ -804,7 +808,7 @@ ldap_distproc_db_init_common(
 
        be->bd_info = lback;
        be->be_private = NULL;
-       t = lback->bi_db_init( be );
+       t = lback->bi_db_init( be, NULL );
        if ( t != 0 ) {
                return t;
        }
@@ -831,11 +835,11 @@ ldap_distproc_db_init_one(
        BackendInfo     *bi = be->bd_info;
        ldapinfo_t      *li;
 
-       int             t;
+       slap_op_t       t;
 
        be->bd_info = lback;
        be->be_private = NULL;
-       t = lback->bi_db_init( be );
+       t = lback->bi_db_init( be, NULL );
        if ( t != 0 ) {
                return t;
        }
@@ -845,7 +849,7 @@ ldap_distproc_db_init_one(
        li->li_nretries = lc->lc_common_li->li_nretries;
        li->li_flags = lc->lc_common_li->li_flags;
        li->li_version = lc->lc_common_li->li_version;
-       for ( t = 0; t < LDAP_BACK_OP_LAST; t++ ) {
+       for ( t = 0; t < SLAP_OP_LAST; t++ ) {
                li->li_timeout[ t ] = lc->lc_common_li->li_timeout[ t ];
        }
        be->bd_info = bi;