]> git.sur5r.net Git - openldap/commitdiff
Fix replacing of all values with an empty value.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 5 Dec 2001 01:16:12 +0000 (01:16 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 5 Dec 2001 01:16:12 +0000 (01:16 +0000)
servers/slapd/modify.c
servers/slapd/value.c

index 783d9ac89f81482bf8a5566a74b6c5517951e55c..c8a616d5e7dbcb0d6fabbeead1f59422badecb5c 100644 (file)
@@ -220,7 +220,7 @@ do_modify(
 #ifdef LDAP_DEBUG
 #ifdef NEW_LOGGING
        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
-                  "do_modify: modifications:\n" ));
+               "do_modify: modifications:\n" ));
 #else
        Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
 #endif
@@ -231,13 +231,41 @@ do_modify(
                           "\t%s:  %s\n", tmp->ml_op == LDAP_MOD_ADD ?
                           "add" : (tmp->ml_op == LDAP_MOD_DELETE ?
                                    "delete" : "replace"), tmp->ml_type ));
+
+               if ( tmp->ml_bvalues == NULL ) {
+                       LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                          "\t\tno values" ));
+               } else if ( tmp->ml_bvalues[0] == NULL ) {
+                       LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                          "\t\tzero values" ));
+               } else if ( tmp->ml_bvalues[1] == NULL ) {
+                       LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                          "\t\tone value" ));
+               } else {
+                       LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                          "\t\tmultiple values" ));
+               }
+
 #else
                Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
                        tmp->ml_op == LDAP_MOD_ADD
                                ? "add" : (tmp->ml_op == LDAP_MOD_DELETE
                                        ? "delete" : "replace"), tmp->ml_type, 0 );
-#endif
 
+               if ( tmp->ml_bvalues == NULL ) {
+                       Debug( LDAP_DEBUG_ARGS, "%s\n",
+                          "\t\tno values", NULL, NULL );
+               } else if ( tmp->ml_bvalues[0] == NULL ) {
+                       Debug( LDAP_DEBUG_ARGS, "%s\n",
+                          "\t\tzero values", NULL, NULL );
+               } else if ( tmp->ml_bvalues[1] == NULL ) {
+                       Debug( LDAP_DEBUG_ARGS, "%s, length %ld\n",
+                          "\t\tone value", (long) tmp->ml_bvalues[0]->bv_len, NULL );
+               } else {
+                       Debug( LDAP_DEBUG_ARGS, "%s\n",
+                          "\t\tmultiple values", NULL, NULL );
+               }
+#endif
        }
 #endif
 
index 88768204bd93005a6f42dcad654a17ca07f7d5c4..cb87d5e4e28459ddd72b3582be765f01900b75bb 100644 (file)
@@ -33,6 +33,7 @@ value_add(
                *vals = (struct berval **) ch_malloc( (nn + 1)
                    * sizeof(struct berval *) );
                n = 0;
+
        } else {
                for ( n = 0; (*vals)[n] != NULL; n++ )
                        ;       /* NULL */
@@ -41,10 +42,8 @@ value_add(
        }
 
        for ( i = 0, j = 0; i < nn; i++ ) {
-               if ( addvals[i]->bv_len > 0 ) {
-                       (*vals)[n + j] = ber_bvdup( addvals[i] );
-                       if( (*vals)[n + j++] == NULL ) break;
-               }
+               (*vals)[n + j] = ber_bvdup( addvals[i] );
+               if( (*vals)[n + j++] == NULL ) break;
        }
        (*vals)[n + j] = NULL;