ldap/servers/slapd/back-ldbm/ldbm_delete.c | 19 +++++++++++++++++--
ldap/servers/slapd/dn.c | 3 ++-
2 files changed, 19 insertions(+), 3 deletions(-)
New commits:
commit 3579393628d9f256613e20d4b1ec248ea3feee2e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 13 17:56:43 2015 -0700
Ticket #48133 - Non tombstone entry which dn starting with "nsuniqueid=...,"
cannot be deleted
Bug Description: Trying to delete an entry which DN starts with
"nsuniqueid=...," but no objectclass=nsTombstone fails with
"Turning a tombstone into a tombstone!", which is indeed not.
Fix Description: This patch checks the entry and if it does not
have "objectclass=nsTombstone", the entry is not treated as a
tombstone. Also, if the DN already has the entry's nsuniqueid
at the beginning, it does not get appended to avoid the duplicate.
Note: Adding an entry which DN starts with "nsuniqueid" and no
nsTombstone objectclass fails since such an entry is rejected in
check_rdn_for_created_attrs called from do_add.
https://fedorahosted.org/389/ticket/48133
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 171a9a9..d744e94 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -454,13 +454,28 @@ ldbm_back_delete( Slapi_PBlock *pb )
char *tombstone_dn;
Slapi_Value *tomb_value;
- if (slapi_is_special_rdn(edn, RDN_IS_TOMBSTONE)) {
+ if (slapi_entry_attr_hasvalue(e->ep_entry, SLAPI_ATTR_OBJECTCLASS,
SLAPI_ATTR_VALUE_TOMBSTONE) &&
+ slapi_is_special_rdn(edn, RDN_IS_TOMBSTONE)) {
LDAPDebug1Arg(LDAP_DEBUG_ANY, "Turning a tombstone into a tombstone!
\"%s\"\n", edn);
ldap_result_code= LDAP_OPERATIONS_ERROR;
retval = -1;
goto error_return;
}
- tombstone_dn = compute_entry_tombstone_dn(edn, childuniqueid);
+ if (!childuniqueid) {
+ slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
+ "No nsUniqueId in the entry \"%s\"; e: 0x%p,
cache_state: 0x%x, refcnt: %d\n",
+ edn, e, e->ep_state, e->ep_refcnt);
+ ldap_result_code = LDAP_OPERATIONS_ERROR;
+ retval = -1;
+ goto error_return;
+ }
+ if ((0 == PL_strncmp(edn + sizeof(SLAPI_ATTR_UNIQUEID), childuniqueid,
strlen(childuniqueid))) &&
+ (*(edn + SLAPI_ATTR_UNIQUEID_LENGTH + slapi_uniqueIDSize() + 1/*=*/) == ','))
{
+ /* The DN already starts with "nsuniqueid=...," */
+ tombstone_dn = slapi_ch_strdup(edn);
+ } else {
+ tombstone_dn = compute_entry_tombstone_dn(edn, childuniqueid);
+ }
slapi_sdn_set_ndn_byval(&nscpEntrySDN,
slapi_sdn_get_ndn(slapi_entry_get_sdn(e->ep_entry)));
commit d132bc4014dc5bd5f69f403ca415de0007713b61
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Feb 19 10:22:02 2015 -0800
Coverity fix - Invalid Dereference in ndn_cache_add (dn.c)
diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index 9c1084f..db050c8 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -2936,7 +2936,8 @@ ndn_cache_add(char *dn, size_t dn_len, char *ndn, size_t ndn_len)
new_node->next = NULL;
} else {
new_node->next = ndn_cache->head;
- ndn_cache->head->prev = new_node;
+ if(ndn_cache->head)
+ ndn_cache->head->prev = new_node;
}
ndn_cache->head = new_node;
PR_Unlock(lru_lock);