]> git.sur5r.net Git - openldap/commitdiff
improve previous commit
authorPierangelo Masarati <ando@openldap.org>
Wed, 6 Sep 2006 12:05:38 +0000 (12:05 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 6 Sep 2006 12:05:38 +0000 (12:05 +0000)
servers/slapd/attr.c

index 22481eb6c38d117330d48654e9f92f5005f87d23..4c21b9bfc0332f9d171deac124d2ca337d2cff40 100644 (file)
@@ -307,6 +307,11 @@ attr_merge(
        return rc;
 }
 
+/*
+ * if a normalization function is defined for the equality matchingRule
+ * of desc, the value is normalized and stored in nval; otherwise nval 
+ * is NULL
+ */
 int
 attr_normalize(
        AttributeDescription    *desc,
@@ -361,41 +366,12 @@ attr_merge_normalize(
        BerVarray       nvals = NULL;
        int             rc;
 
-#if 0
-       if ( desc->ad_type->sat_equality &&
-               desc->ad_type->sat_equality->smr_normalize )
-       {
-               int     i;
-               
-               for ( i = 0; !BER_BVISNULL( &vals[i] ); i++ );
-
-               nvals = slap_sl_calloc( sizeof(struct berval), i + 1, memctx );
-               for ( i = 0; !BER_BVISNULL( &vals[i] ); i++ ) {
-                       rc = (*desc->ad_type->sat_equality->smr_normalize)(
-                                       SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
-                                       desc->ad_type->sat_syntax,
-                                       desc->ad_type->sat_equality,
-                                       &vals[i], &nvals[i], memctx );
-
-                       if ( rc != LDAP_SUCCESS ) {
-                               BER_BVZERO( &nvals[i + 1] );
-                               goto error_return;
-                       }
-               }
-               BER_BVZERO( &nvals[i] );
-       }
-#endif
-
        rc = attr_normalize( desc, vals, &nvals, memctx );
        if ( rc == LDAP_SUCCESS ) {
                rc = attr_merge( e, desc, vals, nvals );
-       }
-
-#if 0
-error_return:;
-#endif 
-       if ( nvals != NULL ) {
-               ber_bvarray_free_x( nvals, memctx );
+               if ( nvals != NULL ) {
+                       ber_bvarray_free_x( nvals, memctx );
+               }
        }
 
        return rc;
@@ -434,6 +410,11 @@ attr_merge_one(
        return rc;
 }
 
+/*
+ * if a normalization function is defined for the equality matchingRule
+ * of desc, the value is normalized and stored in nval; otherwise nval 
+ * is NULL
+ */
 int
 attr_normalize_one(
        AttributeDescription *desc,
@@ -478,23 +459,6 @@ attr_merge_normalize_one(
                nvalp = &nval;
        }
 
-#if 0
-       if ( desc->ad_type->sat_equality &&
-               desc->ad_type->sat_equality->smr_normalize )
-       {
-               rc = desc->ad_type->sat_equality->smr_normalize)
-                               SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
-                               desc->ad_type->sat_syntax,
-                               desc->ad_type->sat_equality,
-                               val, &nval, memctx );
-
-               if ( rc != LDAP_SUCCESS ) {
-                       return rc;
-               }
-               nvalp = &nval;
-       }
-#endif
-
        rc = attr_merge_one( e, desc, val, nvalp );
        if ( nvalp != NULL ) {
                slap_sl_free( nval.bv_val, memctx );