From 8dacb6d51ddd8e6ccb859545d1d9d3d192d244fd Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Tue, 24 Jan 2012 11:35:53 +0100 Subject: [PATCH] ITS#7132 Fix syncrepl access to freed naming attr --- servers/slapd/syncrepl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 1a074ed41c..1dcf979ac6 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -2636,7 +2636,7 @@ typedef struct dninfo { int delOldRDN; /* Was old RDN deleted? */ Modifications **modlist; /* the modlist we received */ Modifications *mods; /* the modlist we compared */ - Attribute *oldNattr; /* old naming attr */ + int oldNcount; /* #values of old naming attr */ AttributeDescription *oldDesc; /* for renames */ AttributeDescription *newDesc; /* for renames */ } dninfo; @@ -2954,10 +2954,10 @@ retry_add:; * If delOldRDN is TRUE then we should see a delete modop * for oldDesc. We might see a replace instead. * delete with no values: therefore newDesc != oldDesc. - * if oldNattr had only one value, then Drop this op. + * if oldNcount == 1, then Drop this op. * delete with 1 value: can only be the oldRDN value. Drop op. * delete with N values: Drop oldRDN value, keep remainder. - * replace with 1 value: if oldNattr had only one value and + * replace with 1 value: if oldNcount == 1 and * newDesc == oldDesc, Drop this op. * Any other cases must be left intact. * @@ -2978,7 +2978,7 @@ retry_add:; continue; } if ( mod->sml_numvals <= 1 && - dni.oldNattr->a_numvals == 1 && + dni.oldNcount == 1 && ( mod->sml_op == LDAP_MOD_DELETE || mod->sml_op == LDAP_MOD_REPLACE )) { if ( mod->sml_op == LDAP_MOD_REPLACE ) @@ -4133,7 +4133,7 @@ dn_callback( dni->oldDesc = ad; for ( oldpos=0, a=rs->sr_entry->e_attrs; a && a->a_desc != ad; oldpos++, a=a->a_next ); - dni->oldNattr = a; + dni->oldNcount = a->a_numvals; for ( newpos=0, a=dni->new_entry->e_attrs; a && a->a_desc != ad; newpos++, a=a->a_next ); if ( !a || oldpos != newpos || attr_valfind( a, -- 2.39.2