X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-bdb%2Ffilterindex.c;h=a54ccf7cd16fdcc947eadb8026bac4e4af8edf86;hb=b905811d3c800b6f4031d541e424e5de871aa0c7;hp=9c823ad9a6d98430898292d310cbd5d1c92ab5ca;hpb=45aaaddb16a30f42e7f33eee68bee8ad020a38c9;p=openldap diff --git a/servers/slapd/back-bdb/filterindex.c b/servers/slapd/back-bdb/filterindex.c index 9c823ad9a6..a54ccf7cd1 100644 --- a/servers/slapd/back-bdb/filterindex.c +++ b/servers/slapd/back-bdb/filterindex.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2000-2008 The OpenLDAP Foundation. + * Copyright 2000-2011 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -697,28 +697,6 @@ 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, @@ -740,7 +718,17 @@ equality_candidates( 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 ); + EntryInfo *ei = NULL; + rc = bdb_cache_find_ndn( op, rtxn, &ava->aa_value, &ei ); + if ( rc == LDAP_SUCCESS ) { + /* exactly one ID can match */ + ids[0] = 1; + ids[1] = ei->bei_id; + } + if ( ei ) { + bdb_cache_entryinfo_unlock( ei ); + } + return rc; } BDB_IDL_ALL( bdb, ids );