Rename filter entry's strcpy_special() to strcpy_regex() to better

reflect its purpose.  Modify switch to support REG_EXTENDED expressions.
Use REG_EXTENDED instead of REG_BASIC everywhere.
Modify <ac/regex.h> to support <gnuregex.h> for testing purposes.
Requires: env CPPFLAGS="-DHAVE_GNUREGEX_H=1" LIBS=-lgnuregex ./configure
This commit is contained in:
Kurt Zeilenga 1999-08-24 01:13:30 +00:00
parent b8a3a153bb
commit 2d2719123d
3 changed files with 20 additions and 10 deletions

View file

@ -25,6 +25,10 @@
For NT: http://people.delphi.com/gjc/hs_regex.html
*/
#error "No POSIX REGEX available."
#elif HAVE_GNUREGEX_H
/* system has GNU gnuregex.h */
# include <gnuregex.h>
#else
/* have regex.h, assume it's POSIX compliant */
# include <regex.h>

View file

@ -253,7 +253,7 @@ ldap_getfirstfilter(
continue;
/* compile flp->ifl_pattern, continue if we fail */
if (regcomp(&re, flp->lfl_pattern, 0) != 0)
if (regcomp(&re, flp->lfl_pattern, REG_EXTENDED) != 0)
continue;
/* match ifl_pattern and lfd_curval, continue if we fail */

View file

@ -283,18 +283,24 @@ test_filter_list(
}
static void
strcpy_special( char *d, char *s )
strcpy_regex( char *d, char *s )
{
for ( ; *s; s++ ) {
switch ( *s ) {
case '^':
case '.':
case '\\':
case '[':
case ']':
case ']': /* ? */
case '$':
case '(':
case ')': /* ? */
case '|':
case '*':
case '+':
case '^':
case '$':
case '?':
case '{':
case '}': /* ? */
case '\\':
*d++ = '\\';
/* FALL */
default:
@ -356,7 +362,7 @@ test_substring_filter(
0, 0, 0 );
return( -1 );
}
strcpy_special( p, f->f_sub_initial );
strcpy_regex( p, f->f_sub_initial );
p = strchr( p, '\0' );
}
if ( f->f_sub_any != NULL ) {
@ -369,7 +375,7 @@ test_substring_filter(
}
strcpy( p, ".*" );
p = strchr( p, '\0' );
strcpy_special( p, f->f_sub_any[i] );
strcpy_regex( p, f->f_sub_any[i] );
p = strchr( p, '\0' );
}
}
@ -382,7 +388,7 @@ test_substring_filter(
}
strcpy( p, ".*" );
p = strchr( p, '\0' );
strcpy_special( p, f->f_sub_final );
strcpy_regex( p, f->f_sub_final );
p = strchr( p, '\0' );
strcpy( p, "$" );
}
@ -390,7 +396,7 @@ test_substring_filter(
/* compile the regex */
Debug( LDAP_DEBUG_FILTER, "test_substring_filter: regcomp pat: %s\n",
pat, 0, 0 );
if ((rc = regcomp(&re, pat, 0))) {
if ((rc = regcomp(&re, pat, REG_EXTENDED))) {
char error[512];
regerror(rc, &re, error, sizeof(error));