ldap_pvt_thread_rdwr_wlock(&li->li_giant_rwlock);
/* get entry with writer lock */
- if ( (e = dn2entry_w( op->o_bd, &op->o_req_ndn, &matched )) == NULL ) {
+ e = dn2entry_w( op->o_bd, &op->o_req_ndn, &matched );
+
+ /* FIXME : dn2entry() should return non-glue entry */
+ if ( e == NULL || ( !manageDSAit && is_entry_glue( e ))) {
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, INFO,
"ldbm_back_delete: no such object %s\n", op->o_req_dn.bv_val, 0, 0 );
cache_return_entry_r( &li->li_cache, matched );
} else {
- rs->sr_ref = referral_rewrite( default_referral,
- NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
+ BerVarray deref = NULL;
+ if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
+ syncinfo_t *si;
+ LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
+ struct berval tmpbv;
+ ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
+ ber_bvarray_add( &deref, &tmpbv );
+ }
+ } else {
+ deref = default_referral;
+ }
+ rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
+ LDAP_SCOPE_DEFAULT );
}
ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
free( (char *)rs->sr_matched );
-
+ rs->sr_ref = NULL;
+ rs->sr_matched = NULL;
return( -1 );
}
/* check entry for "entry" acl */
-#ifdef LDAP_CACHING
- if( !op->o_caching_on ) {
-#endif /* LDAP_CACHING */
if ( ! access_allowed( op, e,
entry, NULL, ACL_WRITE, NULL ) )
{
send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS,
"no write access to entry" );
- rc = 1;
+ rc = LDAP_INSUFFICIENT_ACCESS;
goto return_results;
}
send_ldap_result( op, rs );
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
-
- rc = 1;
+ rs->sr_ref = NULL;
+ rs->sr_matched = NULL;
+ rc = LDAP_REFERRAL;
goto return_results;
}
if( (p = dn2entry_w( op->o_bd, &pdn, NULL )) == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, ERR,
- "ldbm_back_delete: parent of (%s) does not exist\n", op->o_req_dn. 0, 0 );
+ "ldbm_back_delete: parent of (%s) does not exist\n", op->o_req_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- ldbm_back_delete: parent does not exist\n",
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, ERR,
"ldbm_back_delete: (%s) has no "
- "parent & not a root.\n", dn, 0, 0 );
+ "parent & not a root.\n", op->o_ndn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- ldbm_back_delete: no parent & "
}
}
}
-#ifdef LDAP_CACHING
- }
-#endif /* LDAP_CACHING */
/* delete from dn2id mapping */
if ( dn2id_delete( op->o_bd, &e->e_nname, e->e_id ) != 0 ) {
}
/* delete attribute indices */
- (void) index_entry_del( op->o_bd, e );
+ (void) index_entry_del( op, e );
rs->sr_err = LDAP_SUCCESS;
send_ldap_result( op, rs );
- rc = 0;
+ rc = LDAP_SUCCESS;
return_results:;
if( p != NULL ) {