]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#7766 Include all relevant attributes in diff
authorOndřej Kuzník <ondra@mistotebe.net>
Thu, 21 Jan 2021 16:04:53 +0000 (16:04 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 16 Aug 2021 16:18:14 +0000 (16:18 +0000)
servers/slapd/syncrepl.c

index 0e64a0f5f08c027561e178838e786e52cf2b205d..bdb589612bdf4ed26a0635a6e2f6898025f88292 100644 (file)
@@ -4479,6 +4479,32 @@ void syncrepl_diff_entry( Operation *op, Attribute *old, Attribute *new,
                new = new->a_next;
                old = old->a_next;
        }
+
+       /* These are all missing from provider */
+       while ( old ) {
+               Modifications *mod = ch_malloc( sizeof( Modifications ) );
+
+               mod->sml_op = LDAP_MOD_DELETE;
+               mod->sml_flags = 0;
+               mod->sml_desc = old->a_desc;
+               mod->sml_type = mod->sml_desc->ad_cname;
+               mod->sml_numvals = 0;
+               mod->sml_values = NULL;
+               mod->sml_nvalues = NULL;
+
+               *modtail = mod;
+               modtail = &mod->sml_next;
+
+               old = old->a_next;
+       }
+
+       /* Newly added attributes */
+       while ( new ) {
+               attr_cmp( op, NULL, new, &modtail, &ml );
+
+               new = new->a_next;
+       }
+
        *modtail = *ml;
        *ml = NULL;
 }