]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#7239 Do not log internal ops
authorOndřej Kuzník <ondra@mistotebe.net>
Mon, 11 Oct 2021 12:21:34 +0000 (13:21 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 18 Jan 2022 20:11:46 +0000 (20:11 +0000)
servers/slapd/overlays/syncprov.c
servers/slapd/syncrepl.c

index 41a409dcd547f3b64c828e352e2e26981e34d1dd..f6aaca497cfc73bca7aea8aa42dd68b1446449b1 100644 (file)
@@ -514,6 +514,7 @@ syncprov_findbase( Operation *op, fbase_cookie *fc )
                cb.sc_private = fc;
 
                fop.o_sync_mode = 0;    /* turn off sync mode */
+               fop.o_dont_replicate = 1;
                fop.o_managedsait = SLAP_CONTROL_CRITICAL;
                fop.o_callback = &cb;
                fop.o_tag = LDAP_REQ_SEARCH;
@@ -702,6 +703,7 @@ syncprov_findcsn( Operation *op, find_csn_t mode, struct berval *csn )
        fop.o_sync_mode &= SLAP_CONTROL_MASK;   /* turn off sync_mode */
        /* We want pure entries, not referrals */
        fop.o_managedsait = SLAP_CONTROL_CRITICAL;
+       fop.o_dont_replicate = 1;
 
        cf.f_ava = &eq;
        cf.f_av_desc = slap_schema.si_ad_entryCSN;
@@ -1781,6 +1783,7 @@ check_uuidlist_presence(
        fop.ors_attrs = slap_anlist_all_attributes;
        fop.ors_attrsonly = 0;
        fop.o_managedsait = SLAP_CONTROL_CRITICAL;
+       fop.o_dont_replicate = 1;
 
        af.f_choice = LDAP_FILTER_AND;
        af.f_next = NULL;
@@ -2267,6 +2270,7 @@ syncprov_play_accesslog( Operation *op, SlapReply *rs, sync_control *srs,
 
        fop = *op;
        fop.o_sync_mode = 0;
+       fop.o_dont_replicate = 1;
        fop.o_bd = db;
        rc = be_entry_get_rw( &fop, &si->si_logbase, NULL, ad_minCSN, 0, &e );
        if ( rc ) {
index 81be13aba9cbb8f3e2d3fa6afdf6b1c3ddf16166..5c46b89f6ad312a5c91d0737835a9b09b0305281 100644 (file)
@@ -2889,6 +2889,7 @@ syncrepl_op_modify( Operation *op, SlapReply *rs )
                an[0].an_name = ad_reqMod->ad_cname;
                op2.ors_attrs = an;
                op2.ors_attrsonly = 0;
+               op2.o_dont_replicate = 1;
 
                bv = mod->sml_nvalues[0];
 
@@ -4141,6 +4142,8 @@ syncrepl_entry(
        op->ors_attrs = slap_anlist_all_attributes;
        op->ors_attrsonly = 0;
 
+       op->o_dont_replicate = 1;
+
        /* set callback function */
        op->o_callback = &cb;
        cb.sc_response = dn_callback;
@@ -4155,6 +4158,7 @@ syncrepl_entry(
                        "syncrepl_entry: %s be_search (%d)\n", 
                        si->si_ridtxt, rc );
 
+       op->o_dont_replicate = 0;
        if ( !BER_BVISNULL( &op->ors_filterstr ) ) {
                slap_sl_free( op->ors_filterstr.bv_val, op->o_tmpmemctx );
        }
@@ -4290,6 +4294,7 @@ retry_add:;
                                        op2.ors_limit = NULL;
                                        op2.ors_slimit = 1;
                                        op2.ors_tlimit = SLAP_NO_LIMIT;
+                                       op2.o_dont_replicate = 1;
                                        BER_BVZERO( &op2.o_csn );
 
                                        f.f_choice = LDAP_FILTER_PRESENT;
@@ -4686,6 +4691,7 @@ syncrepl_del_nonpresent(
        op->o_time = slap_get_time();
        op->ors_tlimit = SLAP_NO_LIMIT;
 
+       op->o_dont_replicate = 1;
 
        if ( uuids ) {
                Filter uf;
@@ -4778,6 +4784,7 @@ syncrepl_del_nonpresent(
        }
 
        op->o_nocaching = 0;
+       op->o_dont_replicate = 0;
 
        if ( !LDAP_LIST_EMPTY( &si->si_nonpresentlist ) ) {
 
@@ -4808,6 +4815,9 @@ syncrepl_del_nonpresent(
                        cb.sc_private = si;
                        op->o_req_dn = *np_prev->npe_name;
                        op->o_req_ndn = *np_prev->npe_nname;
+
+                       /* avoid timestamp collisions */
+                       slap_op_time( &op->o_time, &op->o_tincr );
                        rc = op->o_bd->be_delete( op, &rs_delete );
                        Debug( LDAP_DEBUG_SYNC,
                                "syncrepl_del_nonpresent: %s be_delete %s (%d)\n", 
@@ -4848,6 +4858,8 @@ syncrepl_del_nonpresent(
                                op->o_tag = LDAP_REQ_MODIFY;
                                op->orm_modlist = &mod1;
 
+                               /* avoid timestamp collisions */
+                               slap_op_time( &op->o_time, &op->o_tincr );
                                rc = op->o_bd->be_modify( op, &rs_modify );
                                if ( mod3.sml_next ) slap_mods_free( mod3.sml_next, 1 );
                        }
@@ -4855,6 +4867,7 @@ syncrepl_del_nonpresent(
                        while ( rs_delete.sr_err == LDAP_SUCCESS &&
                                        op->o_delete_glue_parent ) {
                                op->o_delete_glue_parent = 0;
+                               op->o_dont_replicate = 1;
                                if ( !be_issuffix( be, &op->o_req_ndn ) ) {
                                        slap_callback cb = { NULL };
                                        cb.sc_response = syncrepl_null_callback;
@@ -4871,6 +4884,7 @@ syncrepl_del_nonpresent(
                        }
 
                        op->o_delete_glue_parent = 0;
+                       op->o_dont_replicate = 0;
 
                        ber_bvfree( np_prev->npe_name );
                        ber_bvfree( np_prev->npe_nname );
@@ -5040,7 +5054,13 @@ syncrepl_add_glue(
        Backend *be = op->o_bd;
        SlapReply       rs_add = {REP_RESULT};
 
+       /*
+        * Glue entries are local and should not be sent out or logged by accesslog
+        * except as part of a delete
+        */
+       op->o_dont_replicate = 1;
        rc = syncrepl_add_glue_ancestors( op, e );
+       op->o_dont_replicate = 0;
        switch ( rc ) {
        case LDAP_SUCCESS:
        case LDAP_ALREADY_EXISTS: