mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 16:49:39 -05:00
persistent search updates with recent changes
This commit is contained in:
parent
89270499f8
commit
7e7429267e
6 changed files with 50 additions and 24 deletions
|
|
@ -487,10 +487,12 @@ return_results:
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -340,6 +340,10 @@ bdb_cancel( Operation *op, SlapReply *rs )
|
|||
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;
|
||||
}
|
||||
|
|
@ -972,7 +976,7 @@ id2entry_retry:
|
|||
* 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 )
|
||||
|
|
|
|||
|
|
@ -1070,12 +1070,16 @@ operations_error:
|
|||
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:
|
||||
|
|
|
|||
|
|
@ -951,6 +951,8 @@ LDAP_SLAPD_F (void *) sl_calloc LDAP_P(( ber_len_t nelem, ber_len_t size, void *
|
|||
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 ));
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct slab_heap {
|
|||
void *h_end;
|
||||
};
|
||||
|
||||
static void
|
||||
void
|
||||
sl_mem_destroy(
|
||||
void *key,
|
||||
void *data
|
||||
|
|
@ -72,6 +72,20 @@ sl_mem_create(
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -807,6 +807,8 @@ syncrepl_message_to_entry(
|
|||
if ( *syncstate == LDAP_SYNC_PRESENT ) {
|
||||
e = NULL;
|
||||
goto done;
|
||||
} else if ( *syncstate == LDAP_SYNC_DELETE ) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( *modlist == NULL ) {
|
||||
|
|
@ -917,11 +919,8 @@ syncrepl_entry(
|
|||
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 );
|
||||
|
||||
|
|
@ -954,26 +953,27 @@ syncrepl_entry(
|
|||
|
||||
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;
|
||||
|
|
@ -1022,11 +1022,11 @@ syncrepl_entry(
|
|||
|
||||
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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue