]> git.sur5r.net Git - openldap/commitdiff
use the most recent contextCSN (ITS#5675)
authorPierangelo Masarati <ando@openldap.org>
Tue, 2 Sep 2008 20:35:51 +0000 (20:35 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 2 Sep 2008 20:35:51 +0000 (20:35 +0000)
servers/slapd/syncrepl.c

index 4378ee9383d7880e95108fbb13a01329d1c40af3..a9214532946dc2489b74d4d8db3bb1381954d85d 100644 (file)
@@ -473,7 +473,7 @@ check_syncprov(
                        for ( i=0; i<num; i++ ) {
                                if ( ber_bvcmp( &a.a_nvals[i],
                                        &si->si_cookieState->cs_vals[i] )) {
-                                       changed =1;
+                                       changed = 1;
                                        break;
                                }
                        }
@@ -2770,8 +2770,13 @@ syncrepl_updateCookie(
                        if ( memcmp( syncCookie->ctxcsn[i].bv_val,
                                si->si_cookieState->cs_vals[j].bv_val, len ) > 0 ) {
                                mod.sml_values[j] = syncCookie->ctxcsn[i];
-                               if ( BER_BVISNULL( &first ))
+                               if ( BER_BVISNULL( &first ) ) {
+                                       first = syncCookie->ctxcsn[i];
+
+                               } else if ( memcmp( syncCookie->ctxcsn[i].bv_val, first.bv_val, first.bv_len ) > 0 )
+                               {
                                        first = syncCookie->ctxcsn[i];
+                               }
                        }
                        break;
                }
@@ -2781,8 +2786,12 @@ syncrepl_updateCookie(
                                ( mod.sml_numvals+2 )*sizeof(struct berval), op->o_tmpmemctx );
                        mod.sml_values[mod.sml_numvals++] = syncCookie->ctxcsn[i];
                        BER_BVZERO( &mod.sml_values[mod.sml_numvals] );
-                       if ( BER_BVISNULL( &first ))
+                       if ( BER_BVISNULL( &first ) ) {
+                               first = syncCookie->ctxcsn[i];
+                       } else if ( memcmp( syncCookie->ctxcsn[i].bv_val, first.bv_val, first.bv_len ) > 0 )
+                       {
                                first = syncCookie->ctxcsn[i];
+                       }
                }
        }
        /* Should never happen, ITS#5065 */