From 11b1818b1620f779b950f5f12ae56d3f405059f8 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 22 Jan 2007 14:38:07 +0000 Subject: [PATCH] Partial fix for prev commit --- servers/slapd/syncrepl.c | 45 ++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 11 deletions(-) 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; } -- 2.39.5