ldap/servers/slapd/back-ldbm/id2entry.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit 350142039530c439bd98f3af5ec858d98134ac25
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Sep 2 10:49:01 2010 -0700
Bug 627738 - The cn=monitor statistics entries for the dnentry cache
do not change or change very rarely
https://bugzilla.redhat.com/show_bug.cgi?id=627738
Description:
Change made in this commit: cc36301a7cae6737d9f8a0e53bed653a52130a1d
for the following bug introduced a missing-cache-return bug:
id2entry_add_ext replaces an dn instance in the dn cache even if
the DN value is identical. Replace it only when they don't match.
Thanks to andrey.ivanov(a)polytechnique.fr for finding it out:
https://bugzilla.redhat.com/show_bug.cgi?id=627738#c5
diff --git a/ldap/servers/slapd/back-ldbm/id2entry.c
b/ldap/servers/slapd/back-ldbm/id2entry.c
index 4051214..15d742c 100644
--- a/ldap/servers/slapd/back-ldbm/id2entry.c
+++ b/ldap/servers/slapd/back-ldbm/id2entry.c
@@ -102,9 +102,10 @@ id2entry_add_ext( backend *be, struct backentry *e, back_txn *txn,
int encrypt
/* If the ID already exists in the DN cache && the DNs do not match,
* replace it. */
- if ((CACHE_ADD( &inst->inst_dncache, bdn, &oldbdn ) == 1)
&&
- (slapi_sdn_compare(sdn, oldbdn->dn_sdn))) {
- cache_replace( &inst->inst_dncache, oldbdn, bdn );
+ if (CACHE_ADD( &inst->inst_dncache, bdn, &oldbdn ) == 1) {
+ if (slapi_sdn_compare(sdn, oldbdn->dn_sdn)) {
+ cache_replace( &inst->inst_dncache, oldbdn, bdn );
+ }
CACHE_RETURN(&inst->inst_dncache, &oldbdn); /* to free oldbdn
*/
}