From 627de4de152f4346c92f379e1625950f1ac77fd3 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 25 Feb 2003 19:21:18 +0000 Subject: [PATCH] Additional indexer normalization (need to check all Indexers) --- servers/slapd/schema_init.c | 43 +++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index c7f4aadbf0..53cdb6a6f2 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -1390,11 +1390,11 @@ static int caseExactIgnoreSubstringsIndexer( BerVarray values, BerVarray *keysp ) { - unsigned casefold; - ber_len_t i, nkeys; + unsigned casefold, wasspace; + ber_len_t i, j, nkeys; size_t slen, mlen; BerVarray keys; - BerVarray nvalues; + BerVarray tvalues, nvalues; HASH_CONTEXT HASHcontext; unsigned char HASHdigest[HASH_BYTES]; @@ -1414,10 +1414,39 @@ static int caseExactIgnoreSubstringsIndexer( casefold = ( mr != caseExactSubstringsMatchingRule ) ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD; + tvalues = ch_malloc( sizeof( struct berval ) * (i+1) ); nvalues = ch_malloc( sizeof( struct berval ) * (i+1) ); + for( i=0; values[i].bv_val != NULL; i++ ) { - UTF8bvnormalize( &values[i], &nvalues[i], casefold ); + UTF8bvnormalize( &values[i], &tvalues[i], casefold ); + + /* collapse spaces (in place) */ + nvalues[i].bv_len = 0; + nvalues[i].bv_val = tvalues[i].bv_val; + + wasspace=1; + for( j=0; j