send_ldap_result( op, rs );
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
- if ( rs->sr_err == LDAP_SUCCESS && !noop ) {
+ if ( rs->sr_err == LDAP_SUCCESS && !noop ) {
+ BEI(e) = eip;
LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE );
}
+ BEI(e) = NULL;
}
#endif
rs->sr_err = LDAP_CANCELLED;
send_ldap_result( ps_list, rs );
+ if ( ps_list->o_tmpmemctx ) {
+ sl_mem_destroy( NULL, ps_list->o_tmpmemctx );
+ }
+
slap_op_free ( ps_list );
return LDAP_SUCCESS;
}
* scope while we are looking at it, and unless we're using
* BDB_HIER, its parents cannot be moved either.
*/
- switch( op->ors_scope ) {
+ switch( sop->ors_scope ) {
case LDAP_SCOPE_BASE:
/* This is always true, yes? */
if ( id == base.e_id )
goto co_op_free;
#endif
#ifdef LDAP_CLIENT_UPDATE
- if ( ( op->o_clientupdate_type & SLAP_LCUP_PERSIST ) )
+ if ( ( op->o_clientupdate_type & SLAP_LCUP_PERSIST ) ) {
+ sl_mem_detach( ctx, memctx );
goto no_co_op_free;
+ }
#endif
#ifdef LDAP_SYNC
- if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) )
+ if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) ) {
+ sl_mem_detach( ctx, memctx );
goto no_co_op_free;
+ }
#endif
co_op_free:
LDAP_SLAPD_F (void) sl_free LDAP_P(( void *, void *ctx ));
LDAP_SLAPD_F (void) sl_mem_init LDAP_P(( void ));
LDAP_SLAPD_F (void *) sl_mem_create LDAP_P(( ber_len_t size, void *ctx ));
+LDAP_SLAPD_F (void) sl_mem_detach LDAP_P(( void *ctx, void *memctx ));
+LDAP_SLAPD_F (void) sl_mem_destroy LDAP_P(( void *key, void *data ));
LDAP_SLAPD_F (void *) sl_mark LDAP_P(( void *ctx ));
LDAP_SLAPD_F (void) sl_release LDAP_P(( void *, void *ctx ));
LDAP_SLAPD_F (void *) sl_context LDAP_P(( void *ptr ));
void *h_end;
};
-static void
+void
sl_mem_destroy(
void *key,
void *data
return sh;
}
+void
+sl_mem_detach(
+ void *ctx,
+ void *memctx
+)
+{
+ struct slab_heap *sh = memctx;
+ int size = sh->h_end - sh->h_base;
+
+ sh->h_base = ch_realloc( sh->h_base, size );
+
+ ldap_pvt_thread_pool_setkey( ctx, sl_mem_init, NULL, NULL );
+}
+
void *
sl_malloc(
ber_len_t size,
if ( *syncstate == LDAP_SYNC_PRESENT ) {
e = NULL;
goto done;
+ } else if ( *syncstate == LDAP_SYNC_DELETE ) {
+ goto done;
}
if ( *modlist == NULL ) {
return 0;
}
- if ( !attr_find( e->e_attrs, slap_schema.si_ad_entryUUID )) {
- attr_merge_one( e, slap_schema.si_ad_entryUUID, syncUUID, syncUUID );
- }
-
- filterstr = (char *) sl_malloc( strlen("entryUUID=") + syncUUID->bv_len + 1, op->o_tmpmemctx );
+ filterstr = (char *) sl_malloc( strlen("entryUUID=") + syncUUID->bv_len + 1,
+ op->o_tmpmemctx );
strcpy( filterstr, "entryUUID=" );
strcat( filterstr, syncUUID->bv_val );
cb.sc_response = null_callback;
- if ( si->syncUUID_ndn )
- printf("syncUUID_ndn = %s\n", si->syncUUID_ndn );
+ rc = LDAP_SUCCESS;
+
+ if ( si->syncUUID_ndn ) {
+ op->o_req_dn = *si->syncUUID_ndn;
+ op->o_req_ndn = *si->syncUUID_ndn;
+ op->o_tag = LDAP_REQ_DELETE;
+ rc = be->be_delete( op, &rs );
+ }
switch ( syncstate ) {
case LDAP_SYNC_ADD :
case LDAP_SYNC_MODIFY :
- rc = LDAP_SUCCESS;
-
- if ( si->syncUUID_ndn ) {
- op->o_req_dn = *si->syncUUID_ndn;
- op->o_req_ndn = *si->syncUUID_ndn;
- op->o_tag = LDAP_REQ_DELETE;
- rc = be->be_delete( op, &rs );
- }
-
if ( rc == LDAP_SUCCESS ||
rc == LDAP_REFERRAL ||
rc == LDAP_NO_SUCH_OBJECT ||
rc == DB_NOTFOUND ) {
+
+ if ( !attr_find( e->e_attrs, slap_schema.si_ad_entryUUID )) {
+ attr_merge_one( e, slap_schema.si_ad_entryUUID, syncUUID, syncUUID );
+ }
op->o_tag = LDAP_REQ_ADD;
op->ora_e = e;
op->o_req_dn = e->e_name;
si->e = NULL;
return 1;
+
case LDAP_SYNC_DELETE :
- op->o_tag = LDAP_REQ_DELETE;
- be->be_delete( op, &rs );
- si->e = NULL;
+ /* Already deleted */
return 1;
+
default :
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,