]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10290 Move syncrepl_modify_cb to the end of the list
authorOndřej Kuzník <ondra@mistotebe.net>
Mon, 9 Dec 2024 16:41:44 +0000 (16:41 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 16 Dec 2024 20:00:25 +0000 (20:00 +0000)
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.

servers/slapd/syncrepl.c

index 773000fbf17f4adfb2d20ae9f0ff4dedf57b1e3f..afc6a593dabd8155a0eb192a57bb39b1ec27aecd 100644 (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 ) {