]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/modify.c
ITS#2368 - fix deleting key from range IDL
[openldap] / servers / slapd / modify.c
index 94d642c2b557e0b0ae7746ef31306a8ce8434f16..1d3c7b325ff97b4b7e77bd46dcfd3a418d15838b 100644 (file)
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "lutil.h"
-
 #include "ldap_pvt.h"
 #include "slap.h"
 #ifdef LDAP_SLAPI
 #include "slapi.h"
 #endif
+#include "lutil.h"
+
 
 int
 do_modify(
@@ -276,7 +276,6 @@ do_modify(
                }
 #endif
        }
-#endif
 
        if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
                char abuf[BUFSIZ/2], *ptr = abuf;
@@ -304,6 +303,7 @@ do_modify(
                                op->o_connid, op->o_opid, abuf, 0, 0 );
                }
        }
+#endif /* LDAP_DEBUG */
 
        manageDSAit = get_manageDSAit( op );
 
@@ -607,15 +607,30 @@ int slap_mods_check(
                                }
                        }
 
+                       /*
+                        * a rough single value check... an additional check is needed
+                        * to catch add of single value to existing single valued attribute
+                        */
+                       if ((ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE)
+                               && nvals > 1 && is_at_single_value( ad->ad_type ))
+                       {
+                               snprintf( textbuf, textlen,
+                                       "%s: multiple values provided",
+                                       ml->sml_type.bv_val );
+                               *text = textbuf;
+                               return LDAP_CONSTRAINT_VIOLATION;
+                       }
+
 #ifdef SLAP_NVALUES
                        if( nvals && ad->ad_type->sat_equality &&
-                               ad->ad_type->sat_equality->smr_match &&
-                               ad->ad_type->sat_syntax->ssyn_normalize )
+                               ad->ad_type->sat_equality->smr_normalize )
                        {
                                ml->sml_nvalues = ch_malloc( (nvals+1)*sizeof(struct berval) );
                                for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
-                                       rc = ad->ad_type->sat_syntax->ssyn_normalize(
+                                       rc = ad->ad_type->sat_equality->smr_normalize(
+                                               0,
                                                ad->ad_type->sat_syntax,
+                                               ad->ad_type->sat_equality,
                                                &ml->sml_values[nvals], &ml->sml_nvalues[nvals] );
                                        if( rc ) {
 #ifdef NEW_LOGGING
@@ -638,20 +653,6 @@ int slap_mods_check(
                                ml->sml_nvalues[nvals].bv_len = 0;
                        }
 #endif
-
-                       /*
-                        * a rough single value check... an additional check is needed
-                        * to catch add of single value to existing single valued attribute
-                        */
-                       if ((ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE)
-                               && nvals > 1 && is_at_single_value( ad->ad_type ))
-                       {
-                               snprintf( textbuf, textlen,
-                                       "%s: multiple value provided",
-                                       ml->sml_type.bv_val );
-                               *text = textbuf;
-                               return LDAP_CONSTRAINT_VIOLATION;
-                       }
                }
        }