Entry *matched;
struct berval pdn;
Entry *e, *p = NULL;
- int rootlock = 0;
int rc = -1;
int manageDSAit = get_manageDSAit( op );
AttributeDescription *children = slap_schema.si_ad_children;
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn->bv_val, 0, 0);
#endif
+ /* grab giant lock for writing */
+ ldap_pvt_thread_rdwr_wlock(&li->li_giant_rwlock);
+
/* get entry with writer lock */
if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) {
char *matched_dn = NULL;
NULL, dn, LDAP_SCOPE_DEFAULT );
}
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
send_ldap_result( conn, op, LDAP_REFERRAL,
matched_dn, NULL, refs, NULL );
}
/* delete from parent's id2children entry */
- if( (pdn.bv_val = dn_parent( be, e->e_ndn )) != NULL && pdn.bv_val[ 0 ] != '\0' ) {
- pdn.bv_len = e->e_nname.bv_len - (pdn.bv_val - e->e_ndn);
+ if( !be_issuffix( be, &e->e_nname ) && (dnParent( &e->e_nname, &pdn ),
+ pdn.bv_len) ) {
if( (p = dn2entry_w( be, &pdn, NULL )) == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
/* check parent for "children" acl */
if ( ! access_allowed( be, conn, op, p,
- children, NULL, ACL_WRITE ) )
+ children, NULL, ACL_WRITE, NULL ) )
{
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
} else {
/* no parent, must be root to delete */
if( ! be_isroot( be, &op->o_ndn ) ) {
- if ( be_issuffix( be, "" ) || be_isupdate( be, &op->o_ndn ) ) {
+ if ( be_issuffix( be, (struct berval *)&slap_empty_bv ) || be_isupdate( be, &op->o_ndn ) ) {
p = (Entry *)&slap_entry_root;
rc = access_allowed( be, conn, op, p,
- children, NULL, ACL_WRITE );
+ children, NULL, ACL_WRITE, NULL );
p = NULL;
/* check parent for "children" acl */
goto return_results;
}
}
-
- ldap_pvt_thread_mutex_lock(&li->li_root_mutex);
- rootlock = 1;
}
/* delete from dn2id mapping */
cache_return_entry_w( &li->li_cache, p );
}
- if ( rootlock ) {
- /* release root lock */
- ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
- }
-
/* free entry and writer lock */
cache_return_entry_w( &li->li_cache, e );
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
return rc;
}