Partially revert previous commit. Fix startup csn generation.

Fix findbase initialization.
This commit is contained in:
Howard Chu 2004-11-29 05:54:55 +00:00
parent 0145d54325
commit 948aca3540

View File

@ -152,9 +152,6 @@ syncprov_state_ctrl(
ctrls[num_ctrls] = op->o_tmpalloc( sizeof ( LDAPControl ), op->o_tmpmemctx ); ctrls[num_ctrls] = op->o_tmpalloc( sizeof ( LDAPControl ), op->o_tmpmemctx );
/* NOTE: this function is called also for referrals;
* in this case, e is null, right? */
if ( e ) {
for ( a = e->e_attrs; a != NULL; a = a->a_next ) { for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
AttributeDescription *desc = a->a_desc; AttributeDescription *desc = a->a_desc;
if ( desc == slap_schema.si_ad_entryUUID ) { if ( desc == slap_schema.si_ad_entryUUID ) {
@ -170,7 +167,6 @@ syncprov_state_ctrl(
ber_printf( ber, "{eON}", ber_printf( ber, "{eON}",
entry_sync_state, &entryuuid_bv ); entry_sync_state, &entryuuid_bv );
} }
}
ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_SYNC_STATE; ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_SYNC_STATE;
ctrls[num_ctrls]->ldctl_iscritical = (op->o_sync == SLAP_CONTROL_CRITICAL); ctrls[num_ctrls]->ldctl_iscritical = (op->o_sync == SLAP_CONTROL_CRITICAL);
@ -431,6 +427,9 @@ findbase_cb( Operation *op, SlapReply *rs )
} }
} }
} }
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY, "findbase failed! %d\n", rs->sr_err,0,0 );
}
return LDAP_SUCCESS; return LDAP_SUCCESS;
} }
@ -456,6 +455,7 @@ syncprov_findbase( Operation *op, fbase_cookie *fc )
fop.o_tag = LDAP_REQ_SEARCH; fop.o_tag = LDAP_REQ_SEARCH;
fop.ors_scope = LDAP_SCOPE_BASE; fop.ors_scope = LDAP_SCOPE_BASE;
fop.ors_deref = fc->fss->s_op->ors_deref; fop.ors_deref = fc->fss->s_op->ors_deref;
fop.ors_limit = NULL;
fop.ors_slimit = 1; fop.ors_slimit = 1;
fop.ors_tlimit = SLAP_NO_LIMIT; fop.ors_tlimit = SLAP_NO_LIMIT;
fop.ors_attrs = slap_anlist_no_attrs; fop.ors_attrs = slap_anlist_no_attrs;
@ -599,6 +599,7 @@ syncprov_findcsn( Operation *op, int mode )
srs->sr_state.ctxcsn->bv_val ); srs->sr_state.ctxcsn->bv_val );
fop.o_callback = &cb; fop.o_callback = &cb;
fop.ors_limit = NULL;
fop.ors_tlimit = SLAP_NO_LIMIT; fop.ors_tlimit = SLAP_NO_LIMIT;
fop.ors_filter = &cf; fop.ors_filter = &cf;
fop.ors_filterstr = fbuf; fop.ors_filterstr = fbuf;
@ -1262,9 +1263,7 @@ syncprov_search_response( Operation *op, SlapReply *rs )
if ( rs->sr_type == REP_SEARCH || rs->sr_type == REP_SEARCHREF ) { if ( rs->sr_type == REP_SEARCH || rs->sr_type == REP_SEARCHREF ) {
int i; int i;
/* FIXME: when rs->sr_type == REP_SEARCHREF, if ( srs->sr_state.ctxcsn ) {
* rs->sr_entry is NULL! */
if ( srs->sr_state.ctxcsn && rs->sr_entry ) {
Attribute *a = attr_find( rs->sr_entry->e_attrs, Attribute *a = attr_find( rs->sr_entry->e_attrs,
slap_schema.si_ad_entryCSN ); slap_schema.si_ad_entryCSN );
/* Don't send the ctx entry twice */ /* Don't send the ctx entry twice */
@ -1630,10 +1629,6 @@ syncprov_db_open(
rc = be_entry_get_rw( op, be->be_nsuffix, NULL, rc = be_entry_get_rw( op, be->be_nsuffix, NULL,
slap_schema.si_ad_contextCSN, 0, &e ); slap_schema.si_ad_contextCSN, 0, &e );
BER_BVZERO( &si->si_ctxcsn );
/* FIXME: when rs->sr_type == REP_SEARCHREF,
* rs->sr_entry == NULL! */
if ( e ) { if ( e ) {
a = attr_find( e->e_attrs, slap_schema.si_ad_contextCSN ); a = attr_find( e->e_attrs, slap_schema.si_ad_contextCSN );
if ( a ) { if ( a ) {
@ -1647,7 +1642,7 @@ syncprov_db_open(
be_entry_release_r( op, e ); be_entry_release_r( op, e );
} }
if ( BER_BVISNULL( &si->si_ctxcsn ) ) { if ( BER_BVISEMPTY( &si->si_ctxcsn ) ) {
slap_get_csn( op, si->si_ctxcsnbuf, sizeof(si->si_ctxcsnbuf), slap_get_csn( op, si->si_ctxcsnbuf, sizeof(si->si_ctxcsnbuf),
&si->si_ctxcsn, 0 ); &si->si_ctxcsn, 0 );
} }