From: Pierangelo Masarati Date: Thu, 14 Feb 2002 16:01:48 +0000 (+0000) Subject: first round at replacing UTF8normalize with UTF8bvnormalize X-Git-Tag: OPENLDAP_REL_ENG_2_1_BP~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ef607e65d7be94c2be1389f505a9b4b9a8f37615;p=openldap first round at replacing UTF8normalize with UTF8bvnormalize --- diff --git a/include/ldap_pvt_uc.h b/include/ldap_pvt_uc.h index c28216c2d6..fb3b29b5a0 100644 --- a/include/ldap_pvt_uc.h +++ b/include/ldap_pvt_uc.h @@ -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 *, diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 24b7c73ff7..d2308d9967 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -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 ); } diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index a392547a61..c46fbe54b1 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -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 ) {