-#else
- if ( a->a_syntax & SYNTAX_BIN ) {
- Debug( LDAP_DEBUG_FILTER, "test_substring_filter bin attr\n",
- 0, 0, 0 );
- return LDAP_INAPPROPRIATE_MATCHING;
- }
-
- /*
- * construct a regular expression corresponding to the
- * filter and let regex do the work
- */
-
- pat[0] = '\0';
- p = pat;
- end = pat + sizeof(pat) - 2; /* leave room for null */
- if ( f->f_sub_initial != NULL ) {
- strcpy( p, "^" );
- p = strchr( p, '\0' );
- /* 2 * in case every char is special */
- if ( p + 2 * f->f_sub_initial->bv_len > end ) {
- Debug( LDAP_DEBUG_ANY, "not enough pattern space\n",
- 0, 0, 0 );
- return LDAP_OTHER;
- }
- strcpy_regex( p, f->f_sub_initial->bv_val );
- p = strchr( p, '\0' );
- }
- if ( f->f_sub_any != NULL ) {
- for ( i = 0; f->f_sub_any[i] != NULL; i++ ) {
- /* ".*" + value */
- if ( p + 2 * f->f_sub_any[i]->bv_len + 2 > end ) {
- Debug( LDAP_DEBUG_ANY,
- "not enough pattern space\n", 0, 0, 0 );
- return LDAP_OTHER;
- }
- strcpy( p, ".*" );
- p = strchr( p, '\0' );
- strcpy_regex( p, f->f_sub_any[i]->bv_val );
- p = strchr( p, '\0' );
- }
- }
- if ( f->f_sub_final != NULL ) {
- /* ".*" + value */
- if ( p + 2 * f->f_sub_final->bv_len + 2 > end ) {
- Debug( LDAP_DEBUG_ANY, "not enough pattern space\n",
- 0, 0, 0 );
- return( -1 );
- }
- strcpy( p, ".*" );
- p = strchr( p, '\0' );
- strcpy_regex( p, f->f_sub_final->bv_val );
- p = strchr( p, '\0' );
- strcpy( p, "$" );
- }
-
- /* compile the regex */
- Debug( LDAP_DEBUG_FILTER, "test_substring_filter: regcomp pat: %s\n",
- pat, 0, 0 );
- if ((rc = regcomp(&re, pat, REG_EXTENDED|REG_NOSUB))) {
- char error[512];
-
- regerror(rc, &re, error, sizeof(error));
- Debug( LDAP_DEBUG_ANY, "regcomp failed (%s) %s\n",
- p, error, 0 );
- return LDAP_OTHER;