From: Pierangelo Masarati Date: Sat, 2 Nov 2002 16:00:21 +0000 (+0000) Subject: fix attribute delete (ITS#2158) patch provided by Timofey B. Nickonov X-Git-Tag: NO_SLAP_OP_BLOCKS~816 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a777c535643644b546de33d964b5909caa1ba4c5;p=openldap fix attribute delete (ITS#2158) patch provided by Timofey B. Nickonov --- diff --git a/servers/slapd/back-ldap/modify.c b/servers/slapd/back-ldap/modify.c index bea4dcbcd7..bb45b385c0 100644 --- a/servers/slapd/back-ldap/modify.c +++ b/servers/slapd/back-ldap/modify.c @@ -139,13 +139,18 @@ ldap_back_modify( ml->sml_bvalues, conn ); } #endif /* ENABLE_REWRITE */ - - for (j = 0; ml->sml_bvalues[j].bv_val; j++); - mods[i].mod_bvalues = (struct berval **)ch_malloc((j+1) * - sizeof(struct berval *)); - for (j = 0; ml->sml_bvalues[j].bv_val; j++) - mods[i].mod_bvalues[j] = &ml->sml_bvalues[j]; - mods[i].mod_bvalues[j] = NULL; + + if ( ml->sml_bvalues != NULL ) { + for (j = 0; ml->sml_bvalues[j].bv_val; j++); + mods[i].mod_bvalues = (struct berval **)ch_malloc((j+1) * + sizeof(struct berval *)); + for (j = 0; ml->sml_bvalues[j].bv_val; j++) + mods[i].mod_bvalues[j] = &ml->sml_bvalues[j]; + mods[i].mod_bvalues[j] = NULL; + } else { + mods[i].mod_bvalues = NULL; + } + i++; } modv[i] = 0; diff --git a/servers/slapd/back-meta/modify.c b/servers/slapd/back-meta/modify.c index b6890382c8..7b3208bc53 100644 --- a/servers/slapd/back-meta/modify.c +++ b/servers/slapd/back-meta/modify.c @@ -179,12 +179,18 @@ meta_back_modify( ml->sml_bvalues, conn ); } - for (j = 0; ml->sml_bvalues[ j ].bv_val; j++); - mods[ i ].mod_bvalues = (struct berval **)ch_malloc((j+1) * - sizeof(struct berval *)); - for (j = 0; ml->sml_bvalues[ j ].bv_val; j++) - mods[ i ].mod_bvalues[ j ] = &ml->sml_bvalues[j]; - mods[ i ].mod_bvalues[ j ] = NULL; + if ( ml->sml_bvalues != NULL ){ + for (j = 0; ml->sml_bvalues[ j ].bv_val; j++); + mods[ i ].mod_bvalues = (struct berval **)ch_malloc((j+1) * + sizeof(struct berval *)); + for (j = 0; ml->sml_bvalues[ j ].bv_val; j++) + mods[ i ].mod_bvalues[ j ] = &ml->sml_bvalues[j]; + mods[ i ].mod_bvalues[ j ] = NULL; + + } else { + mods[ i ].mod_bvalues = NULL; + } + i++; } modv[ i ] = 0;