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>
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 */
}
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:
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 ) {
}
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' );
}
}
}
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, "$" );
}
/* 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));