]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/translucent.c
Happy New Year
[openldap] / servers / slapd / overlays / translucent.c
index 66f751205c4c30f99dd3683eaf1b7c78c11799dc..372f05383beb9e56697ff321b39ead16f1315c19 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2004-2013 The OpenLDAP Foundation.
+ * Copyright 2004-2018 The OpenLDAP Foundation.
  * Portions Copyright 2005 Symas Corporation.
  * All rights reserved.
  *
@@ -420,12 +420,12 @@ static int translucent_modify(Operation *op, SlapReply *rs) {
        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);
+       op->o_bd = db;
        if(rc != LDAP_SUCCESS || re == NULL ) {
                send_ldap_error((op), rs, LDAP_NO_SUCH_OBJECT,
                        "attempt to modify nonexistent local record");
                return(rs->sr_err);
        }
-       op->o_bd = db;
 /*
 ** fetch entry from local backend;
 ** if it exists:
@@ -439,7 +439,7 @@ static int translucent_modify(Operation *op, SlapReply *rs) {
 **
 */
 
-       op->o_bd->bd_info = (BackendInfo *) on->on_info;
+       op->o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
        rc = be_entry_get_rw(op, &op->o_req_ndn, NULL, NULL, 0, &e);
        op->o_bd->bd_info = (BackendInfo *) on;
 
@@ -486,7 +486,7 @@ release:
                        } else
                                entry_free(re);
                }
-               op->o_bd->bd_info = (BackendInfo *) on->on_info;
+               op->o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
                be_entry_release_r(op, e);
                op->o_bd->bd_info = (BackendInfo *) on;
                if(erc == SLAP_CB_CONTINUE) {
@@ -662,7 +662,7 @@ static int translucent_pwmod(Operation *op, SlapReply *rs) {
 **     return CONTINUE;
 */
 
-       op->o_bd->bd_info = (BackendInfo *) on->on_info;
+       op->o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
        rc = be_entry_get_rw(op, &op->o_req_ndn, NULL, NULL, 0, &e);
        op->o_bd->bd_info = (BackendInfo *) on;
 
@@ -676,7 +676,7 @@ static int translucent_pwmod(Operation *op, SlapReply *rs) {
                                entry_free(re);
                        }
                }
-               op->o_bd->bd_info = (BackendInfo *) on->on_info;
+               op->o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
                be_entry_release_r(op, e);
                op->o_bd->bd_info = (BackendInfo *) on;
                return SLAP_CB_CONTINUE;
@@ -766,7 +766,7 @@ typedef struct trans_ctx {
        BackendDB *db;
        slap_overinst *on;
        Filter *orig;
-       Avlnode *list;
+       TAvlnode *list;
        int step;
        int slimit;
        AttributeName *attrs;
@@ -788,7 +788,7 @@ static int translucent_search_cb(Operation *op, SlapReply *rs) {
        if ( rs->sr_type == REP_RESULT && ( tc->step & USE_LIST ))
                return 0;
 
-       if(!op || !rs || rs->sr_type != REP_SEARCH || !rs->sr_entry)
+       if(rs->sr_type != REP_SEARCH || !rs->sr_entry)
                return(SLAP_CB_CONTINUE);
 
        Debug(LDAP_DEBUG_TRACE, "==> translucent_search_cb: %s\n",
@@ -1070,6 +1070,9 @@ static int translucent_search(Operation *op, SlapReply *rs) {
        struct berval fbv;
        int rc = 0;
 
+       if ( op->o_managedsait > SLAP_CONTROL_IGNORED )
+               return SLAP_CB_CONTINUE;
+
        Debug(LDAP_DEBUG_TRACE, "==> translucent_search: <%s> %s\n",
                op->o_req_dn.bv_val, op->ors_filterstr.bv_val, 0);
 
@@ -1109,7 +1112,8 @@ 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 = tc.attrs;
+               if ( op->ors_attrs == slap_anlist_all_attributes )
+                       op->ors_attrs = tc.attrs;
                op->o_bd = tc.db;
                if ( fl ) {
                        op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
@@ -1131,7 +1135,7 @@ static int translucent_search(Operation *op, SlapReply *rs) {
        /* Send out anything remaining on the list and finish */
        if ( tc.step & USE_LIST ) {
                if ( tc.list ) {
-                       Avlnode *av;
+                       TAvlnode *av;
 
                        av = tavl_end( tc.list, TAVL_DIR_LEFT );
                        while ( av ) {