]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/id2entry.c
Move MSVC port to the Attic
[openldap] / servers / slapd / back-bdb / id2entry.c
index d4eb26711119a21037a44c44bfb0832f1362fcf5..05501b0e421fb05aabd51ac94c74fc800e581110 100644 (file)
@@ -265,7 +265,7 @@ int bdb_entry_get(
 #endif
 
        if( op ) boi = (struct bdb_op_info *) op->o_private;
-       if( boi != NULL && op->o_bd == boi->boi_bdb ) {
+       if( boi != NULL && op->o_bd->be_private == boi->boi_bdb->be_private ) {
                txn = boi->boi_txn;
                locker = boi->boi_locker;
        }
@@ -376,15 +376,23 @@ return_results:
        if( rc != LDAP_SUCCESS ) {
                /* free entry */
                bdb_cache_return_entry_rw(bdb->bi_dbenv, &bdb->bi_cache, e, rw, &lock);
+
        } else {
-               *ent = e;
-               /* big drag. we need a place to store a read lock so we can
-                * release it later??
-                */
-               if ( op && !boi ) {
-                       boi = op->o_tmpcalloc(1,sizeof(struct bdb_op_info),op->o_tmpmemctx);
-                       boi->boi_lock = lock;
-                       op->o_private = boi;
+               if ( slapMode == SLAP_SERVER_MODE ) {
+                       *ent = e;
+                       /* big drag. we need a place to store a read lock so we can
+                        * release it later??
+                        */
+                       if ( op && !boi ) {
+                               boi = op->o_tmpcalloc(1,sizeof(struct bdb_op_info),op->o_tmpmemctx);
+                               boi->boi_lock = lock;
+                               boi->boi_bdb = op->o_bd;
+                               op->o_private = boi;
+                       }
+
+               } else {
+                       *ent = entry_dup( e );
+                       bdb_cache_return_entry_rw(bdb->bi_dbenv, &bdb->bi_cache, e, rw, &lock);
                }
        }