Friday, March 13, 2015

[389-commits] ldap/servers

ldap/servers/slapd/back-ldbm/ldbm_delete.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit f14fb8b6f71d2a87b650064f15099a2cc2dfd38a
Author: Noriko Hosoi <nhosoi@redhat.com>
Date: Fri Mar 13 16:31: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

Reviewed by rmeggins@redhat.com (Thank you, Rich!!)

diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 498c3c1..619ff4a 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -594,7 +594,8 @@ 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)) {
slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
"conn=%lu op=%d Turning a tombstone into a tombstone! \"%s\"; e: 0x%p, cache_state: 0x%x, refcnt: %d\n",
conn_id, op_id, edn, e, e->ep_state, e->ep_refcnt);
@@ -602,7 +603,21 @@ ldbm_back_delete( Slapi_PBlock *pb )
retval = -1;
goto error_return;
}
- tombstone_dn = compute_entry_tombstone_dn(edn, childuniqueid);
+ if (!childuniqueid) {
+ slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
+ "conn=%lu op=%d No nsUniqueId in the entry \"%s\"; e: 0x%p, cache_state: 0x%x, refcnt: %d\n",
+ conn_id, op_id, 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)));


--
389 commits mailing list
389-commits@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-commits

No comments:

Post a Comment