]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10250 Retrieve old value for attr_diff
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 13 Aug 2024 08:26:21 +0000 (09:26 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 3 Feb 2026 16:49:45 +0000 (16:49 +0000)
servers/slapd/syncrepl.c

index 486f96e0e06ad3200244606d0d344b3eeff78a76..5636cc72400d76c274c869050facb70770bf61fd 100644 (file)
@@ -5805,6 +5805,7 @@ void syncrepl_diff_entry( Operation *op, Attribute *old, Attribute *new,
        Modifications **mods, Modifications **ml, int is_ctx)
 {
        Modifications **modtail = mods;
+       Attribute *old_orig = old;
 
        /* We assume that attributes are saved in the same order
         * in the remote and local databases. So if we walk through
@@ -5815,7 +5816,9 @@ void syncrepl_diff_entry( Operation *op, Attribute *old, Attribute *new,
        {
                /* If we've seen this before, use its mod now */
                if ( new->a_flags & SLAP_ATTR_IXADD ) {
-                       attr_cmp( op, NULL, new, &modtail, &ml );
+                       Attribute *tmp = attr_find( old_orig, new->a_desc );
+                       assert( tmp != NULL );
+                       attr_cmp( op, tmp, new, &modtail, &ml );
                        new = new->a_next;
                        continue;
                }
@@ -5886,7 +5889,12 @@ void syncrepl_diff_entry( Operation *op, Attribute *old, Attribute *new,
 
        /* Newly added attributes */
        while ( new ) {
-               attr_cmp( op, NULL, new, &modtail, &ml );
+               Attribute *tmp = NULL;
+               if ( new->a_flags & SLAP_ATTR_IXADD ) {
+                       tmp = attr_find( old_orig, new->a_desc );
+                       assert( tmp != NULL );
+               }
+               attr_cmp( op, tmp, new, &modtail, &ml );
 
                new = new->a_next;
        }