]> git.sur5r.net Git - openldap/commitdiff
ITS#6717
authorQuanah Gibson-Mount <quanah@openldap.org>
Thu, 13 Jan 2011 22:56:59 +0000 (22:56 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 13 Jan 2011 22:56:59 +0000 (22:56 +0000)
CHANGES
servers/slapd/overlays/syncprov.c

diff --git a/CHANGES b/CHANGES
index ca680d0658ea312504c1b049225854ca547548d9..5e96604c8ce61b5c46dd2912913f54ecaa1c53e4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -105,6 +105,7 @@ OpenLDAP 2.4.24 Engineering
        Fixed slapo-syncprov sessionlog ordering (ITS#6716)
        Fixed slapo-syncprov sessionlog with adds (ITS#6503)
        Fixed slapo-syncprov mutex (ITS#6438)
+       Fixed slapo-syncprov mincsn check with MMR (ITS#6717)
        Fixed slapo-translucent entry leak (ITS#6746)
        Fixed contrib/autogroup LDAP URI with attribute filter (ITS#6536)
        Fixed contrib/autogroup install location (ITS#6684)
index 392656988b6ca4c029deac9cec6f432625e1ff64..9d99bacf55787fedad07212a39e0c0d429bef8fc 100644 (file)
@@ -2415,7 +2415,7 @@ syncprov_op_search( Operation *op, SlapReply *rs )
        sync_control *srs;
        BerVarray ctxcsn;
        int i, *sids, numcsns;
-       struct berval mincsn;
+       struct berval mincsn, maxcsn;
        int dirty = 0;
 
        if ( !(op->o_sync_mode & SLAP_SYNC_REFRESH) ) return SLAP_CB_CONTINUE;
@@ -2530,12 +2530,27 @@ syncprov_op_search( Operation *op, SlapReply *rs )
                        i++;
                }
 
-               /* Find the smallest CSN */
-               mincsn = srs->sr_state.ctxcsn[0];
-               for ( i=1; i<srs->sr_state.numcsns; i++ ) {
-                       if ( ber_bvcmp( &mincsn, &srs->sr_state.ctxcsn[i] ) > 0 )
-                               mincsn = srs->sr_state.ctxcsn[i];
-               }
+               /* Find the smallest CSN which differs from contextCSN */
+               mincsn.bv_len = 0;
+               maxcsn.bv_len = 0;
+               for ( i=0; i<srs->sr_state.numcsns; i++ ) {
+                       for ( j=0; j<numcsns; j++ ) {
+                               if ( srs->sr_state.sids[i] != sids[j] )
+                                       continue;
+                               if ( BER_BVISEMPTY( &maxcsn ) || ber_bvcmp( &maxcsn,
+                                       &srs->sr_state.ctxcsn[i] ) < 0 ) {
+                                       maxcsn = srs->sr_state.ctxcsn[i];
+                               }
+                               if ( ber_bvcmp( &srs->sr_state.ctxcsn[i], &ctxcsn[j] ) < 0) {
+                                       if ( BER_BVISEMPTY( &mincsn ) || ber_bvcmp( &mincsn,
+                                               &srs->sr_state.ctxcsn[i] ) > 0 ) {
+                                               mincsn = srs->sr_state.ctxcsn[i];
+                                       }
+                               }
+                       }
+               }
+               if ( BER_BVISEMPTY( &mincsn ))
+                       mincsn = maxcsn;
 
                /* If nothing has changed, shortcut it */
                if ( srs->sr_state.numcsns == numcsns ) {