mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Add some asserts on CSN validity
This commit is contained in:
parent
58437e838a
commit
686ceac31f
@ -1339,7 +1339,14 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on )
|
||||
SlapReply rsm = { 0 };
|
||||
slap_callback cb = {0};
|
||||
BackendDB be;
|
||||
#ifdef CHECK_CSN
|
||||
Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
|
||||
|
||||
int i;
|
||||
for ( i=0; i<si->si_numcsns; i++ ) {
|
||||
assert( !syn->ssyn_validate( syn, si->si_ctxcsn+i ));
|
||||
}
|
||||
#endif
|
||||
mod.sml_numvals = si->si_numcsns;
|
||||
mod.sml_values = si->si_ctxcsn;
|
||||
mod.sml_nvalues = NULL;
|
||||
@ -1367,6 +1374,11 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on )
|
||||
if ( mod.sml_next != NULL ) {
|
||||
slap_mods_free( mod.sml_next, 1 );
|
||||
}
|
||||
#ifdef CHECK_CSN
|
||||
for ( i=0; i<si->si_numcsns; i++ ) {
|
||||
assert( !syn->ssyn_validate( syn, si->si_ctxcsn+i ));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2876,6 +2876,9 @@ syncrepl_updateCookie(
|
||||
Backend *be = op->o_bd;
|
||||
Modifications mod;
|
||||
struct berval first = BER_BVNULL;
|
||||
#ifdef CHECK_CSN
|
||||
Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
|
||||
#endif
|
||||
|
||||
int rc, i, j;
|
||||
ber_len_t len;
|
||||
@ -2892,6 +2895,15 @@ syncrepl_updateCookie(
|
||||
|
||||
ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
|
||||
|
||||
#ifdef CHECK_CSN
|
||||
for ( i=0; i<syncCookie->numcsns; i++ ) {
|
||||
assert( !syn->ssyn_validate( syn, syncCookie->ctxcsn+i ));
|
||||
}
|
||||
for ( i=0; i<si->si_cookieState->cs_num; i++ ) {
|
||||
assert( !syn->ssyn_validate( syn, si->si_cookieState->cs_vals+i ));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* clone the cookieState CSNs so we can Replace the whole thing */
|
||||
mod.sml_numvals = si->si_cookieState->cs_num;
|
||||
mod.sml_values = op->o_tmpalloc(( mod.sml_numvals+1 )*sizeof(struct berval), op->o_tmpmemctx );
|
||||
@ -2994,6 +3006,12 @@ syncrepl_updateCookie(
|
||||
if ( mod.sml_next ) slap_mods_free( mod.sml_next, 1 );
|
||||
op->o_tmpfree( mod.sml_values, op->o_tmpmemctx );
|
||||
|
||||
#ifdef CHECK_CSN
|
||||
for ( i=0; i<si->si_cookieState->cs_num; i++ ) {
|
||||
assert( !syn->ssyn_validate( syn, si->si_cookieState->cs_vals+i ));
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user