]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#5972 Consider all deletes for syncInfo messages
authorOndřej Kuzník <ondra@mistotebe.net>
Wed, 10 Nov 2021 12:22:07 +0000 (12:22 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 18 Jan 2022 03:34:27 +0000 (03:34 +0000)
A delete of an entry that didn't match filter would be skipped
altogether and the cookie would never be sent to that consumer.

servers/slapd/overlays/syncprov.c

index 73450aa7924a1befb0416790bc7216f097a5c510..7a5a637dc7a5ac990a76d708609ad4f0fb08fdd6 100644 (file)
@@ -1296,7 +1296,9 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
                fc.fdn = &newdn;
                freefdn = 1;
        }
-       if ( op->o_tag != LDAP_REQ_ADD ) {
+       if ( !saveit && op->o_tag == LDAP_REQ_DELETE ) {
+               /* Delete succeeded, there is no entry */
+       } else if ( op->o_tag != LDAP_REQ_ADD ) {
                if ( !SLAP_ISOVERLAY( op->o_bd )) {
                        db = *op->o_bd;
                        op->o_bd = &db;
@@ -1412,7 +1414,7 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
                }
 
                rc = LDAP_COMPARE_FALSE;
-               if ( !is_entry_glue( e ) && fc.fscope ) {
+               if ( e && !is_entry_glue( e ) && fc.fscope ) {
                        ldap_pvt_thread_mutex_lock( &ss->s_mutex );
                        op2 = *ss->s_op;
                        oh = *op->o_hdr;
@@ -2569,26 +2571,7 @@ added:
                have_psearches = ( si->si_ops != NULL );
                ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
                if ( have_psearches ) {
-                       switch(op->o_tag) {
-                       case LDAP_REQ_ADD:
-                       case LDAP_REQ_MODIFY:
-                       case LDAP_REQ_MODRDN:
-                       case LDAP_REQ_EXTENDED:
-                               syncprov_matchops( op, opc, 0 );
-                               break;
-                       case LDAP_REQ_DELETE:
-                               /* for each match in opc->smatches:
-                                *   send DELETE msg
-                                */
-                               for ( sm = opc->smatches; sm; sm=sm->sm_next ) {
-                                       if ( sm->sm_op->s_op->o_abandon )
-                                               continue;
-                                       syncprov_qresp( opc, sm->sm_op, LDAP_SYNC_DELETE );
-                               }
-                               if ( opc->ssres.s_info )
-                                       free_resinfo( &opc->ssres );
-                               break;
-                       }
+                       syncprov_matchops( op, opc, 0 );
                }
 
                /* Add any log records */