- if( matchedDN == NULL ) {
- rc = bdb_id2entry( be, tid, id, e );
+ rc = bdb_cache_find_ndn( op, tid, dn, &ei );
+ if ( rc ) {
+ if ( matched && rc == DB_NOTFOUND ) {
+ /* Set the return value, whether we have its entry
+ * or not.
+ */
+ *e = ei;
+ if ( ei && ei->bei_id )
+ bdb_cache_find_id( op, tid, ei->bei_id,
+ &ei, 1, locker, lock );
+ else if ( ei )
+ bdb_cache_entryinfo_unlock( ei );
+ } else if ( ei ) {
+ bdb_cache_entryinfo_unlock( ei );
+ }