ITS#10290 Move syncrepl_modify_cb to the end of the list

The way op->orm_modlist is allocated by syncrepl_op_modify is not
compatible with slap_mods_free() and so callbacks from any overlays that
touch op->orm_modlist on the way down need a chance to undo their state
first as we go back up.
This commit is contained in:
Ondřej Kuzník 2024-12-09 16:41:44 +00:00 committed by Quanah Gibson-Mount
parent e2b04c434e
commit 62892d090c

View File

@ -2811,7 +2811,6 @@ drop:
typedef struct modify_ctxt {
Modifications *mx_orig;
Modifications *mx_free;
Entry *mx_entry;
} modify_ctxt;
@ -2823,11 +2822,8 @@ syncrepl_modify_cb( Operation *op, SlapReply *rs )
Modifications *ml;
op->orm_no_opattrs = 0;
slap_mods_free( op->orm_modlist, 0 );
op->orm_modlist = mx->mx_orig;
for ( ml = mx->mx_free; ml; ml = mx->mx_free ) {
mx->mx_free = ml->sml_next;
op->o_tmpfree( ml, op->o_tmpmemctx );
}
if ( mx->mx_entry ) {
entry_free( mx->mx_entry );
}
@ -3016,10 +3012,10 @@ syncrepl_op_modify( Operation *op, SlapReply *rs )
sc->sc_next = op->o_callback;
sc->sc_cleanup = NULL;
sc->sc_writewait = NULL;
op->o_callback = sc;
overlay_callback_after_backover( op, sc, 1 );
op->orm_no_opattrs = 1;
mx->mx_orig = op->orm_modlist;
mx->mx_free = newlist;
mx->mx_entry = e_dup;
for ( ml = newlist; ml; ml=ml->sml_next ) {
if ( ml->sml_flags == SLAP_MOD_INTERNAL ) {