]> git.sur5r.net Git - openldap/commitdiff
Fix ITS#4827, was losing the entryCSN mod.
authorHoward Chu <hyc@openldap.org>
Thu, 1 Feb 2007 05:21:21 +0000 (05:21 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 1 Feb 2007 05:21:21 +0000 (05:21 +0000)
servers/slapd/syncrepl.c

index 08fa2b258722812d1b22a9298188253d42b2df6d..58e68f5e16514dbfbf694bd6ecf158d5a8af5ab9 100644 (file)
@@ -2383,7 +2383,7 @@ static void
 attr_cmp( Operation *op, Attribute *old, Attribute *new,
        Modifications ***mret, Modifications ***mcur )
 {
-       int i, j, doadd = 0;
+       int i, j;
        Modifications *mod, **modtail;
 
        modtail = *mret;
@@ -2498,13 +2498,14 @@ attr_cmp( Operation *op, Attribute *old, Attribute *new,
        }
        /* advance to next element */
        mod = **mcur;
-       if ( i != j ) {
-               **mcur = mod->sml_next;
-               *modtail = mod;
-               modtail = &mod->sml_next;
-       } else {
-               if ( mod )
+       if ( mod ) {
+               if ( i != j ) {
+                       **mcur = mod->sml_next;
+                       *modtail = mod;
+                       modtail = &mod->sml_next;
+               } else {
                        *mcur = &mod->sml_next;
+               }
        }
        *mret = modtail;
 }
@@ -2574,12 +2575,12 @@ dn_callback(
                                for ( old = rs->sr_entry->e_attrs, new = dni->new_entry->e_attrs;
                                                old && new; )
                                {
-#if 1
+                                       /* If we've seen this before, use its mod now */
                                        if ( new->a_flags & SLAP_ATTR_IXADD ) {
+                                               attr_cmp( op, NULL, new, &modtail, &ml );
                                                new = new->a_next;
                                                continue;
                                        }
-#endif
                                        if ( old->a_desc != new->a_desc ) {
                                                Modifications *mod;
                                                Attribute *tmp;
@@ -2613,7 +2614,12 @@ dn_callback(
                                                old = old->a_next;
                                                continue;
                                        }
-                                       attr_cmp( op, old, new, &modtail, &ml );
+                                       /* kludge - always update modifiersName so that it
+                                        * stays co-located with the other mod opattrs
+                                        */
+                                       attr_cmp( op, old->a_desc !=
+                                               slap_schema.si_ad_modifiersName ? old : NULL,
+                                               new, &modtail, &ml );
                                        new = new->a_next;
                                        old = old->a_next;
                                }