]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/translucent.c
Fix last commit: C90 rejects declaration after code
[openldap] / servers / slapd / overlays / translucent.c
index a5b4e6a80b5a12391619b4dbfa9993a74a2bb60e..f5d3cf8e380962f1e06d9880c805fbc8e271291d 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2004-2008 The OpenLDAP Foundation.
+ * Copyright 2004-2009 The OpenLDAP Foundation.
  * Portions Copyright 2005 Symas Corporation.
  * All rights reserved.
  *
@@ -95,14 +95,6 @@ static ConfigTable translucentcfg[] = {
        { NULL, NULL, 0, 0, 0, ARG_IGNORED }
 };
 
-static ConfigTable transdummy[] = {
-       { "", "", 0, 0, 0, ARG_IGNORED,
-               NULL, "( OLcfgGlAt:13 NAME 'olcDatabase' "
-                       "DESC 'The backend type for a database instance' "
-                       "SUP olcBackend SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
-       { NULL, NULL, 0, 0, 0, ARG_IGNORED }
-};
-
 static ConfigOCs translucentocs[] = {
        { "( OLcfgOvOc:14.1 "
          "NAME 'olcTranslucentConfig' "
@@ -115,7 +107,7 @@ static ConfigOCs translucentocs[] = {
        { "( OLcfgOvOc:14.2 "
          "NAME 'olcTranslucentDatabase' "
          "DESC 'Translucent target database configuration' "
-         "AUXILIARY )", Cft_Misc, transdummy, translucent_ldadd },
+         "AUXILIARY )", Cft_Misc, olcDatabaseDummy, translucent_ldadd },
        { NULL, 0, NULL }
 };
 /* for translucent_init() */
@@ -167,7 +159,7 @@ translucent_cfadd( Operation *op, SlapReply *rs, Entry *e, ConfigArgs *ca )
        /* FIXME: should not hardcode "olcDatabase" here */
        bv.bv_len = snprintf( ca->cr_msg, sizeof( ca->cr_msg ),
                "olcDatabase=%s", ov->db.bd_info->bi_type );
-       if ( bv.bv_len < 0 || bv.bv_len >= sizeof( ca->cr_msg ) ) {
+       if ( bv.bv_len >= sizeof( ca->cr_msg ) ) {
                return -1;
        }
        bv.bv_val = ca->cr_msg;
@@ -440,6 +432,7 @@ static int translucent_modify(Operation *op, SlapReply *rs) {
 
        db = op->o_bd;
        op->o_bd = &ov->db;
+       ov->db.be_acl = op->o_bd->be_acl;
        rc = ov->db.bd_info->bi_entry_get_rw(op, &op->o_req_ndn, NULL, NULL, 0, &re);
        if(rc != LDAP_SUCCESS || re == NULL ) {
                send_ldap_error((op), rs, LDAP_NO_SUCH_OBJECT,
@@ -637,6 +630,7 @@ static int translucent_compare(Operation *op, SlapReply *rs) {
 */
        db = op->o_bd;
        op->o_bd = &ov->db;
+       ov->db.be_acl = op->o_bd->be_acl;
        rc = ov->db.bd_info->bi_op_compare(op, rs);
        op->o_bd = db;
 
@@ -669,6 +663,7 @@ static int translucent_pwmod(Operation *op, SlapReply *rs) {
 */
        db = op->o_bd;
        op->o_bd = &ov->db;
+       ov->db.be_acl = op->o_bd->be_acl;
        rc = ov->db.bd_info->bi_entry_get_rw(op, &op->o_req_ndn, NULL, NULL, 0, &re);
        if(rc != LDAP_SUCCESS || re == NULL ) {
                send_ldap_error((op), rs, LDAP_NO_SUCH_OBJECT,
@@ -829,7 +824,7 @@ static int translucent_search_cb(Operation *op, SlapReply *rs) {
                        if ( re ) {
                                if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) {
                                        rs->sr_flags ^= REP_ENTRY_MUSTRELEASE;
-                                       be_entry_release_r( op, rs->sr_entry );
+                                       overlay_entry_release_ov( op, rs->sr_entry, 0, on );
                                }
                                if ( rs->sr_flags & REP_ENTRY_MUSTBEFREED ) {
                                        rs->sr_flags ^= REP_ENTRY_MUSTBEFREED;
@@ -863,7 +858,7 @@ static int translucent_search_cb(Operation *op, SlapReply *rs) {
                        re = entry_dup( rs->sr_entry );
                        if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) {
                                rs->sr_flags ^= REP_ENTRY_MUSTRELEASE;
-                               be_entry_release_r( op, rs->sr_entry );
+                               overlay_entry_release_ov( op, rs->sr_entry, 0, on );
                        }
                        if ( rs->sr_flags & REP_ENTRY_MUSTBEFREED ) {
                                rs->sr_flags ^= REP_ENTRY_MUSTBEFREED;
@@ -906,7 +901,7 @@ static int translucent_search_cb(Operation *op, SlapReply *rs) {
                if ( tc->step & LCL_SIDE ) {
                        if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) {
                                rs->sr_flags ^= REP_ENTRY_MUSTRELEASE;
-                               be_entry_release_r( op, rs->sr_entry );
+                               overlay_entry_release_ov( op, rs->sr_entry, 0, on );
                        }
                        if ( rs->sr_flags & REP_ENTRY_MUSTBEFREED ) {
                                rs->sr_flags ^= REP_ENTRY_MUSTBEFREED;
@@ -1104,6 +1099,7 @@ static int translucent_search(Operation *op, SlapReply *rs) {
        cb.sc_private = &tc;
        cb.sc_next = op->o_callback;
 
+       ov->db.be_acl = op->o_bd->be_acl;
        tc.db = op->o_bd;
        tc.on = on;
        tc.orig = op->ors_filter;
@@ -1114,6 +1110,8 @@ static int translucent_search(Operation *op, SlapReply *rs) {
        op->o_callback = &cb;
 
        if ( fr || !fl ) {
+               AttributeName *attrs = op->ors_attrs;
+               op->ors_attrs = NULL;
                op->o_bd = &ov->db;
                tc.step |= RMT_SIDE;
                if ( fl ) {
@@ -1122,6 +1120,7 @@ static int translucent_search(Operation *op, SlapReply *rs) {
                        filter2bv_x( op, fr, &op->ors_filterstr );
                }
                rc = ov->db.bd_info->bi_op_search(op, rs);
+               op->ors_attrs = attrs;
                op->o_bd = tc.db;
                if ( fl ) {
                        op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
@@ -1137,6 +1136,8 @@ static int translucent_search(Operation *op, SlapReply *rs) {
        op->ors_filterstr = fbv;
        op->ors_filter = tc.orig;
        op->o_callback = cb.sc_next;
+       rs->sr_attrs = op->ors_attrs;
+
        /* Send out anything remaining on the list and finish */
        if ( tc.step & USE_LIST ) {
                if ( tc.list ) {
@@ -1201,6 +1202,7 @@ static int translucent_bind(Operation *op, SlapReply *rs) {
 
        db = op->o_bd;
        op->o_bd = &ov->db;
+       ov->db.be_acl = op->o_bd->be_acl;
        rc = ov->db.bd_info->bi_op_bind(op, rs);
        op->o_bd = db;
 
@@ -1276,7 +1278,6 @@ static int translucent_db_init(BackendDB *be, ConfigReply *cr) {
        on->on_bi.bi_private = ov;
        ov->db = *be;
        ov->db.be_private = NULL;
-       ov->db.be_pcl_mutexp = &ov->db.be_pcl_mutex;
        ov->defer_db_open = 1;
 
        if ( !backend_db_init( "ldap", &ov->db, -1, NULL )) {