-#ifndef SLAPD_SCHEMA_NOT_COMPAT
-static int
-test_approx_filter(
- Backend *be,
- Connection *conn,
- Operation *op,
- Entry *e,
- Ava *ava
-)
-{
- char *w1, *w2, *c1, *c2;
- int i;
- Attribute *a;
-
- if ( be != NULL && ! access_allowed( be, conn, op, e,
- ava->ava_type, NULL, ACL_SEARCH ) )
- {
- return( -2 );
- }
-
- a = attr_find( e->e_attrs, ava->ava_type );
- if ( a != NULL ) {
- /* for each value in the attribute */
- for ( i = 0; a->a_vals[i] != NULL; i++ ) {
- /*
- * try to match words in the filter value in order
- * in the attribute value.
- */
-
- w2 = a->a_vals[i]->bv_val;
- /* for each word in the filter value */
- for ( w1 = first_word( ava->ava_value.bv_val ); w1 != NULL;
- w1 = next_word( w1 ) ) {
- if ( (c1 = phonetic( w1 )) == NULL ) {
- break;
- }
-
- /*
- * for each word in the attribute value from
- * where we left off...
- */
- for ( w2 = first_word( w2 ); w2 != NULL;
- w2 = next_word( w2 ) ) {
- c2 = phonetic( w2 );
- if ( strcmp( c1, c2 ) == 0 ) {
- free( c2 );
- break;
- }
- free( c2 );
- }
- free( c1 );
-
- /*
- * if we stopped because we ran out of words
- * before making a match, go on to the next
- * value. otherwise try to keep matching
- * words in this value from where we left off.
- */
- if ( w2 == NULL ) {
- break;
- } else {
- w2 = next_word( w2 );
- }
- }
- /*
- * if we stopped because we ran out of words we
- * have a match.
- */
- if ( w1 == NULL ) {
- return LDAP_COMPARE_TRUE;
- }
- }
- }
-
- return LDAP_COMPARE_FALSE;
-}
-#endif