]> git.sur5r.net Git - openldap/commitdiff
fix attribute delete (ITS#2158) patch provided by Timofey B. Nickonov <ntb@mts.ru>
authorPierangelo Masarati <ando@openldap.org>
Sat, 2 Nov 2002 16:00:21 +0000 (16:00 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 2 Nov 2002 16:00:21 +0000 (16:00 +0000)
servers/slapd/back-ldap/modify.c
servers/slapd/back-meta/modify.c

index bea4dcbcd7506dad6d97c44963fd0492a01e4e91..bb45b385c09f1d352077d356cff095fb750e4399 100644 (file)
@@ -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;
index b6890382c87a809c5504ec730c7b025978d9d02b..7b3208bc53bc91c45542a520872607f5a151d176 100644 (file)
@@ -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;