{
        Operation op = {0};
        Opheader ohdr = {0};
-       EntryInfo ei = {0};
+       EntryInfo *ei = NULL;
+       int rc;
 
        if ( BER_BVISEMPTY(dn) )
                return 0;
        op.o_tmpmemctx = NULL;
        op.o_tmpmfuncs = &ch_mfuncs;
 
-       ei.bei_id = NOID;
-
-       bdb_dn2id( &op, NULL, dn, &ei );
+       rc = bdb_cache_find_ndn( &op, NULL, dn, &ei );
+       if ( ei ) bdb_cache_entryinfo_unlock( ei );
+       if ( rc == DB_NOTFOUND )
+               return NOID;
        
-       return ei.bei_id;
+       return ei->bei_id;
 }
 
 int bdb_tool_id2entry_get(
        assert( be != NULL );
        assert( slapMode & SLAP_TOOL_MODE );
 
-       assert( text != NULL );
-       assert( text->bv_val != NULL );
+       assert( text );
+       assert( text->bv_val );
        assert( text->bv_val[0] == '\0' );      /* overconservative? */
 
        Debug( LDAP_DEBUG_TRACE, "=> " LDAP_XSTRING(bdb_tool_entry_put)
        assert( be != NULL );
        assert( slapMode & SLAP_TOOL_MODE );
 
-       assert( text != NULL );
-       assert( text->bv_val != NULL );
+       assert( text );
+       assert( text->bv_val );
        assert( text->bv_val[0] == '\0' );      /* overconservative? */
 
        assert ( e->e_id != NOID );