From e34a1220d740490a78185fb65bf575766906e419 Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Thu, 1 Aug 2019 18:23:14 +0200 Subject: [PATCH 2/2] Bug 1725845: slapi-nis crashes when returning an entry with invalid DN Bug Description: On a search on compat tree, slapi-nis prepared the set of entries to return. It stores the entries into a hashtable, using the normalized DN as a key. If the entry contains an invalid DN, the key is invalid and triggers a crash while adding the entry in the hashtable https://bugzilla.redhat.com/show_bug.cgi?id=1725845 --- src/back-sch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/back-sch.c b/src/back-sch.c index 3f7e30f..87fa24c 100644 --- a/src/back-sch.c +++ b/src/back-sch.c @@ -1525,16 +1525,17 @@ backend_entries_to_return_push(struct backend_search_cbdata *cbdata, Slapi_Entry struct entries_to_send *e_to_send = NULL; struct cached_entry *entry = NULL; bool_t dont_cache = FALSE; + void *ndn_key = (void *) slapi_entry_get_ndn(e); PLHashTable* ht = (PLHashTable*) cbdata->state->cached_entries; - if ((cbdata == NULL) || (e == NULL)) return; + if ((cbdata == NULL) || (e == NULL) || (ndn_key == NULL)) return; e_to_send = (struct entries_to_send *) slapi_ch_calloc(1, sizeof(struct entries_to_send)); dont_cache = cbdata->state->use_entry_cache ? FALSE : TRUE; if (!wrap_rwlock_wrlock(cbdata->state->cached_entries_lock)) { - entry = PL_HashTableLookup(ht, slapi_entry_get_ndn(e)); + entry = PL_HashTableLookup(ht, ndn_key); if (entry != NULL) { /* There is an entry in the hash table but is it the same? */ char *e_modifyTimestamp = slapi_entry_attr_get_charptr(e, "modifyTimestamp"); -- 2.21.0