From: Howard Chu Date: Mon, 22 Jan 2007 14:38:07 +0000 (+0000) Subject: Partial fix for prev commit X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~159 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=11b1818b1620f779b950f5f12ae56d3f405059f8;p=openldap Partial fix for prev commit --- diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index d5b5357a27..c8048bd2c4 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -2516,19 +2516,42 @@ dn_callback( for ( old = rs->sr_entry->e_attrs, new = dni->new_entry->e_attrs; old && new; ) { +#if 1 + if ( new->a_flags & SLAP_ATTR_IXADD ) { + new = new->a_next; + continue; + } +#endif if ( old->a_desc != new->a_desc ) { - /* Delete old attr, force into new order */ Modifications *mod; - 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_values = NULL; - mod->sml_nvalues = NULL; - *modtail = mod; - modtail = &mod->sml_next; - + Attribute *tmp; + + /* If it's just been re-added later, + * remember that we've seen it. + */ + tmp = attr_find( new, old->a_desc ); + if ( tmp ) { + tmp->a_flags |= SLAP_ATTR_IXADD; + } else { + /* If it's a new attribute, pull it in. + */ + tmp = attr_find( old, new->a_desc ); + if ( !tmp ) { + attr_cmp( op, NULL, new, &modtail, &ml ); + new = new->a_next; + continue; + } + /* Delete old attr */ + 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_values = NULL; + mod->sml_nvalues = NULL; + *modtail = mod; + modtail = &mod->sml_next; + } old = old->a_next; continue; }