Cleanup... never replicate syncConsumersubentries. Plug memleaks.

This commit is contained in:
Howard Chu 2004-11-29 06:51:44 +00:00
parent a88c78d64e
commit d47f98c2eb

View File

@ -795,6 +795,7 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
Attribute *a;
int rc;
struct berval newdn;
int freefdn = 0;
fc.fdn = &op->o_req_ndn;
/* compute new DN */
@ -804,6 +805,7 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
else dnParent( fc.fdn, &pdn );
build_new_dn( &newdn, &pdn, &op->orr_nnewrdn, op->o_tmpmemctx );
fc.fdn = &newdn;
freefdn = 1;
}
if ( op->o_tag != LDAP_REQ_ADD ) {
op->o_bd->bd_info = (BackendInfo *)on->on_info;
@ -814,6 +816,10 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
e = op->ora_e;
}
/* Never replicate these */
if ( is_entry_syncConsumerSubentry( e )) {
goto done;
}
if ( saveit ) {
ber_dupbv_x( &opc->sdn, &e->e_name, op->o_tmpmemctx );
ber_dupbv_x( &opc->sndn, &e->e_nname, op->o_tmpmemctx );
@ -883,11 +889,15 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
}
}
ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
done:
if ( op->o_tag != LDAP_REQ_ADD ) {
op->o_bd->bd_info = (BackendInfo *)on->on_info;
be_entry_release_r( op, e );
op->o_bd->bd_info = (BackendInfo *)on;
}
if ( freefdn ) {
op->o_tmpfree( fc.fdn->bv_val, op->o_tmpmemctx );
}
}
static int
@ -929,6 +939,12 @@ syncprov_op_cleanup( Operation *op, SlapReply *rs )
ch_free( mt );
}
}
if ( !BER_BVISNULL( &opc->suuid ))
op->o_tmpfree( opc->suuid.bv_val, op->o_tmpmemctx );
if ( !BER_BVISNULL( &opc->sndn ))
op->o_tmpfree( opc->sndn.bv_val, op->o_tmpmemctx );
if ( !BER_BVISNULL( &opc->sdn ))
op->o_tmpfree( opc->sdn.bv_val, op->o_tmpmemctx );
op->o_callback = cb->sc_next;
op->o_tmpfree(cb, op->o_tmpmemctx);
}
@ -1263,6 +1279,16 @@ syncprov_search_response( Operation *op, SlapReply *rs )
if ( rs->sr_type == REP_SEARCH || rs->sr_type == REP_SEARCHREF ) {
int i;
/* If we got a referral without a referral object, there's
* something missing that we cannot replicate. Just ignore it.
* The consumer will abort because we didn't send the expected
* control.
*/
if ( !rs->sr_entry ) {
assert( rs->sr_entry );
Debug( LDAP_DEBUG_ANY, "bogus referral in context\n",0,0,0 );
return SLAP_CB_CONTINUE;
}
if ( srs->sr_state.ctxcsn ) {
Attribute *a = attr_find( rs->sr_entry->e_attrs,
slap_schema.si_ad_entryCSN );
@ -1525,7 +1551,6 @@ syncprov_operational(
ad_inlist( slap_schema.si_ad_contextCSN, rs->sr_attrs )) {
Attribute *a, **ap = NULL;
for ( a=rs->sr_entry->e_attrs; a; a=a->a_next ) {
if ( a->a_desc == slap_schema.si_ad_contextCSN )
break;