From 45aaaddb16a30f42e7f33eee68bee8ad020a38c9 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 4 Nov 2008 12:07:47 +0000 Subject: [PATCH] lookup entry id when equality on entryDN (proposed fix for ITS#5791; does not work for back-hdb, though) --- servers/slapd/back-bdb/filterindex.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/servers/slapd/back-bdb/filterindex.c b/servers/slapd/back-bdb/filterindex.c index 6e9ec9d540..9c823ad9a6 100644 --- a/servers/slapd/back-bdb/filterindex.c +++ b/servers/slapd/back-bdb/filterindex.c @@ -697,6 +697,28 @@ done: return rc; } +static int +dn_equality_candidate( + Operation *op, + DB_TXN *rtxn, + struct berval *ndn, + ID *ids ) +{ + struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private; + EntryInfo ei = { 0 }; + DB_LOCK lock; + int rc; + + lock.mode = DB_LOCK_NG; + rc = bdb_dn2id( op, ndn, &ei, rtxn, &lock ); + if ( rc == 0 ) { + BDB_IDL_RANGE( ids, ei.bei_id, ei.bei_id ); + bdb_cache_entry_db_unlock( bdb, &lock ); + } + + return rc; +} + static int equality_candidates( Operation *op, @@ -717,6 +739,10 @@ equality_candidates( Debug( LDAP_DEBUG_TRACE, "=> bdb_equality_candidates (%s)\n", ava->aa_desc->ad_cname.bv_val, 0, 0 ); + if ( ava->aa_desc == slap_schema.si_ad_entryDN ) { + return dn_equality_candidate( op, rtxn, &ava->aa_value, ids ); + } + BDB_IDL_ALL( bdb, ids ); rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_EQUALITY, -- 2.39.5