From: Pierangelo Masarati Date: Fri, 7 Sep 2007 09:40:11 +0000 (+0000) Subject: import fix to ITS#5124 X-Git-Tag: OPENLDAP_REL_ENG_2_3_39~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=771831e6e9574e20790c05c24d3ebccf01379086;p=thirdparty%2Fopenldap.git import fix to ITS#5124 --- diff --git a/CHANGES b/CHANGES index 32790775ed..ffe27ba5f2 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ OpenLDAP 2.3.39 Engineering Fixed slapd-bdb DB_CONFIG conversion bug (ITS#5118) Fixed slapd-sql concurrency issue (ITS#5095) Fixed slapo-pcache and -rwm interaction fix (ITS#4991) + Fixed slapo-rwm modlist handling (ITS#5124) Fixed liblber Windows x64 portability (ITS#5105) Fixed libldap ppolicy control creation (ITS#5103) Documentation diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index b836b5da1c..b52d39a375 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -516,6 +516,34 @@ rwm_op_delete( Operation *op, SlapReply *rs ) return SLAP_CB_CONTINUE; } +/* imported from HEAD */ +static int +ber_bvarray_dup_x( BerVarray *dst, BerVarray src, void *ctx ) +{ + int i, j; + BerVarray new; + + if ( !src ) { + *dst = NULL; + return 0; + } + + for (i=0; !BER_BVISNULL( &src[i] ); i++) ; + new = ber_memalloc_x(( i+1 ) * sizeof(BerValue), ctx ); + if ( !new ) + return -1; + for (j=0; joq_modify.rs_modlist; *mlp; ) { int is_oc = 0; - Modifications *ml; + Modifications *ml = *mlp; struct ldapmapping *mapping = NULL; - /* duplicate the modlist */ - ml = ch_malloc( sizeof( Modifications )); - *ml = **mlp; - *mlp = ml; - + /* ml points to a temporary mod until needs duplication */ if ( ml->sml_desc == slap_schema.si_ad_objectClass || ml->sml_desc == slap_schema.si_ad_structuralObjectClass ) { is_oc = 1; - } else if ( !isupdate && !get_manageDIT( op ) && (*mlp)->sml_desc->ad_type->sat_no_user_mod ) + } else if ( !isupdate && !get_manageDIT( op ) && ml->sml_desc->ad_type->sat_no_user_mod ) { + ml = ch_malloc( sizeof( Modifications ) ); + *ml = **mlp; + if ( (*mlp)->sml_values ) { + ber_bvarray_dup_x( &ml->sml_values, (*mlp)->sml_values, NULL ); + if ( (*mlp)->sml_nvalues ) { + ber_bvarray_dup_x( &ml->sml_nvalues, (*mlp)->sml_nvalues, NULL ); + } + } + *mlp = ml; goto next_mod; } else { @@ -573,6 +606,11 @@ rwm_op_modify( Operation *op, SlapReply *rs ) } } + /* duplicate the modlist */ + ml = ch_malloc( sizeof( Modifications )); + *ml = **mlp; + *mlp = ml; + if ( ml->sml_values != NULL ) { int i, num; struct berval *bva;