]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/syncrepl.c
Partial revert of f30269f5d2e4bb5ee7486fe6542078d1b59dba6d
[openldap] / servers / slapd / syncrepl.c
index 1dcf979ac69b2616035df85e3cffe582d55561b3..39382881a1f2109a1edf60e4ae4e1b6a989576ca 100644 (file)
@@ -2820,6 +2820,23 @@ syncrepl_entry(
                                 */
                                op->o_csn = a->a_vals[0];
                                freecsn = 0;
+                               /* There was no cookie CSN attached to this op,
+                                * make sure it's new enough
+                                */
+                               if ( !syncCSN ) {
+                                       int i, sid = slap_parse_csn_sid( &a->a_vals[0] );
+                                       for ( i = 0; i<si->si_cookieState->cs_num; i++ ) {
+                                               if ( sid < si->si_cookieState->cs_sids[i] )
+                                                       break;
+                                               if ( sid == si->si_cookieState->cs_sids[i] ) {
+                                                       if ( ber_bvcmp( &a->a_vals[0], &si->si_cookieState->cs_vals[i] ) <= 0 ) {
+                                                               Debug( LDAP_DEBUG_SYNC, "do_syncrep2: %s entryCSN too old, ignoring %s (%s)\n",
+                                                               si->si_ridtxt, a->a_vals[0].bv_val, entry->e_name.bv_val );
+                                                               goto done;
+                                                       }
+                                               }
+                                       }
+                               }
                        }
                }
 retry_add:;
@@ -3181,6 +3198,8 @@ retry_modrdn:;
                        Debug( LDAP_DEBUG_SYNC,
                                        "syncrepl_entry: %s be_delete %s (%d)\n", 
                                        si->si_ridtxt, op->o_req_dn.bv_val, rc );
+                       if ( rc == LDAP_NO_SUCH_OBJECT )
+                               rc = LDAP_SUCCESS;
 
                        while ( rs_delete.sr_err == LDAP_SUCCESS
                                && op->o_delete_glue_parent ) {
@@ -4133,7 +4152,10 @@ dn_callback(
                                        dni->oldDesc = ad;
                                        for ( oldpos=0, a=rs->sr_entry->e_attrs;
                                                a && a->a_desc != ad; oldpos++, a=a->a_next );
-                                       dni->oldNcount = a->a_numvals;
+                                       /* a should not be NULL but apparently it happens.
+                                        * ITS#7144
+                                        */
+                                       dni->oldNcount = a ? a->a_numvals : 0;
                                        for ( newpos=0, a=dni->new_entry->e_attrs;
                                                a && a->a_desc != ad; newpos++, a=a->a_next );
                                        if ( !a || oldpos != newpos || attr_valfind( a,