summaryrefslogtreecommitdiffstats
path: root/ldap
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2010-09-08 10:33:23 -0700
committerNathan Kinder <nkinder@redhat.com>2010-09-08 10:40:15 -0700
commit3835f3ccd452c8d8af26f54ac04433f9f581a2ff (patch)
tree9ed1f4142c534183dd9f12d83fb8b84b79498930 /ldap
parenta333e683d6b15eafb5a098e581eb7a281b15137c (diff)
downloadds-3835f3ccd452c8d8af26f54ac04433f9f581a2ff.tar.gz
ds-3835f3ccd452c8d8af26f54ac04433f9f581a2ff.tar.xz
ds-3835f3ccd452c8d8af26f54ac04433f9f581a2ff.zip
Bug 630096 - (cov#15448) Check return value of cache_replace()
We need to check the return value of cache_replace() in id2entry_add_ext(). The only possible error that can be returned is when the entry we are trying to replace is not found in the cache. This should not occur since we are told that the entry already exists by CACHE_ADD() just prior to this call. If we run into this situation, we will just log an error without adding the entry to the cache. This shouldn't be a big deal since the entry will get added to the cache next time it is accessed.
Diffstat (limited to 'ldap')
-rw-r--r--ldap/servers/slapd/back-ldbm/id2entry.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ldap/servers/slapd/back-ldbm/id2entry.c b/ldap/servers/slapd/back-ldbm/id2entry.c
index 15d742c7..198fdd51 100644
--- a/ldap/servers/slapd/back-ldbm/id2entry.c
+++ b/ldap/servers/slapd/back-ldbm/id2entry.c
@@ -104,7 +104,12 @@ id2entry_add_ext( backend *be, struct backentry *e, back_txn *txn, int encrypt
* replace it. */
if (CACHE_ADD( &inst->inst_dncache, bdn, &oldbdn ) == 1) {
if (slapi_sdn_compare(sdn, oldbdn->dn_sdn)) {
- cache_replace( &inst->inst_dncache, oldbdn, bdn );
+ if (cache_replace( &inst->inst_dncache, oldbdn, bdn ) != 0) {
+ /* The entry was not in the cache for some reason (this
+ * should not happen since CACHE_ADD said it existed above). */
+ LDAPDebug( LDAP_DEBUG_ANY, "id2entry_add_ext(): Entry disappeared "
+ "from cache (%s)\n", oldbdn->dn_sdn, 0, 0 );
+ }
}
CACHE_RETURN(&inst->inst_dncache, &oldbdn); /* to free oldbdn */
}