]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/value.c
Tone down debug messages
[openldap] / servers / slapd / value.c
index 2a544c050c0bcaba7538c50e94973d0610ce8f93..9ccdf5c0533558386f4f8eb8fe944a673bd15717 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -409,12 +409,13 @@ ordered_value_sort( Attribute *a, int do_renumber )
 /*
  * wrapper for validate function
  * uses the validate function of the syntax after removing
- * the index, if allowed an present
+ * the index, if allowed and present
  */
 int
 ordered_value_validate(
        AttributeDescription *ad,
-       struct berval *in )
+       struct berval *in,
+       int mop )
 {
        struct berval   bv = *in;
 
@@ -435,6 +436,9 @@ ordered_value_validate(
                        bv.bv_len -= ptr - bv.bv_val;
                        bv.bv_val = ptr;
                        in = &bv;
+                       /* If deleting by index, just succeed */
+                       if ( mop == LDAP_MOD_DELETE && BER_BVISEMPTY( &bv ))
+                               return LDAP_SUCCESS;
                }
        }
 
@@ -544,6 +548,11 @@ ordered_value_normalize(
                        bv.bv_len -= idx.bv_len;
                        bv.bv_val = ptr;
 
+                       /* validator will already prevent this for Adds */
+                       if ( BER_BVISEMPTY( &bv )) {
+                               ber_dupbv_x( normalized, &idx, ctx );
+                               return LDAP_SUCCESS;
+                       }
                        val = &bv;
                }
        }