]> git.sur5r.net Git - openldap/commitdiff
first round at replacing UTF8normalize with UTF8bvnormalize
authorPierangelo Masarati <ando@openldap.org>
Thu, 14 Feb 2002 16:01:48 +0000 (16:01 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 14 Feb 2002 16:01:48 +0000 (16:01 +0000)
include/ldap_pvt_uc.h
servers/slapd/dn.c
servers/slapd/schema_init.c

index c28216c2d6dee159119e2eda3af9babe4347c947..fb3b29b5a07c03f77b05dd8ed818f425d7bfb00e 100644 (file)
@@ -144,6 +144,11 @@ LDAP_LUNICODE_F(char *) UTF8normalize(
        struct berval *,
        unsigned );
 
+LDAP_LUNICODE_F(struct berval *) UTF8bvnormalize(
+       struct berval *,
+       struct berval *,
+       unsigned );
+
 LDAP_LUNICODE_F(int) UTF8normcmp(
        const char *,
        const char *,
index 24b7c73ff7abb72d41d87f2eaa3c97dfa17b171a..d2308d99676963cf71b2817a80e39ef018810d48 100644 (file)
@@ -298,9 +298,10 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
                        if( mr && ( mr->smr_usage & SLAP_MR_DN_FOLD ) ) {
                                char *s = bv.bv_val;
 
-                               ber_str2bv( UTF8normalize( bv.bv_val ? &bv
-                                       : &ava->la_value, LDAP_UTF8_CASEFOLD ),
-                                       0, 0, &bv );
+                               if ( UTF8bvnormalize( &bv, &bv, 
+                                               LDAP_UTF8_CASEFOLD ) == NULL ) {
+                                       return LDAP_INVALID_SYNTAX;
+                               }
                                free( s );
                        }
 
index a392547a61283f5271bb64aa8d9ef5b38ea55143..c46fbe54b11e4d8b167f4546b3d16d5f07206bda 100644 (file)
@@ -609,8 +609,7 @@ UTF8SubstringsassertionNormalize(
        }
 
        if( sa->sa_initial.bv_val != NULL ) {
-               ber_str2bv( UTF8normalize( &sa->sa_initial, casefold ), 0,
-                       0, &nsa->sa_initial );
+               UTF8bvnormalize( &sa->sa_initial, &nsa->sa_initial, casefold );
                if( nsa->sa_initial.bv_val == NULL ) {
                        goto err;
                }
@@ -622,8 +621,8 @@ UTF8SubstringsassertionNormalize(
                }
                nsa->sa_any = (struct berval *)ch_malloc( (i + 1) * sizeof(struct berval) );
                for( i=0; sa->sa_any[i].bv_val != NULL; i++ ) {
-                       ber_str2bv( UTF8normalize( &sa->sa_any[i], casefold ),
-                               0, 0, &nsa->sa_any[i] );
+                       UTF8bvnormalize( &sa->sa_any[i], &nsa->sa_any[i], 
+                                       casefold );
                        if( nsa->sa_any[i].bv_val == NULL ) {
                                goto err;
                        }
@@ -632,8 +631,7 @@ UTF8SubstringsassertionNormalize(
        }
 
        if( sa->sa_final.bv_val != NULL ) {
-               ber_str2bv( UTF8normalize( &sa->sa_final, casefold ), 0,
-                       0, &nsa->sa_final );
+               UTF8bvnormalize( &sa->sa_final, &nsa->sa_final, casefold );
                if( nsa->sa_final.bv_val == NULL ) {
                        goto err;
                }
@@ -1045,7 +1043,7 @@ caseExactIgnoreSubstringsMatch(
 {
        int match = 0;
        SubstringsAssertion *sub = NULL;
-       struct berval left;
+       struct berval left = { 0, NULL };
        int i;
        ber_len_t inlen=0;
        char *nav;
@@ -1054,13 +1052,11 @@ caseExactIgnoreSubstringsMatch(
        casefold = strcmp( mr->smr_oid, caseExactSubstringsMatchOID )
                ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD;
 
-       nav = UTF8normalize( value, casefold );
-       if( nav == NULL ) {
+       if ( UTF8bvnormalize( value, &left, casefold ) == NULL ) {
                match = 1;
                goto done;
        }
-       left.bv_val = nav;
-       left.bv_len = strlen( nav );
+       nav = left.bv_val;
 
        sub = UTF8SubstringsassertionNormalize( assertedValue, casefold );
        if( sub == NULL ) {