allow '$' as action prefix instead of '%'; backward compatibility is preserved

This commit is contained in:
Pierangelo Masarati 2004-03-10 19:21:39 +00:00
parent 823fa1705e
commit 1d1cd21814
3 changed files with 7 additions and 4 deletions

View File

@ -51,7 +51,7 @@ rewrite_map_parse(
* Go to the end of the map invocation (the right closing brace) * Go to the end of the map invocation (the right closing brace)
*/ */
for ( p = string, cnt = 1; p[ 0 ] != '\0' && cnt > 0; p++ ) { for ( p = string, cnt = 1; p[ 0 ] != '\0' && cnt > 0; p++ ) {
if ( p[ 0 ] == REWRITE_SUBMATCH_ESCAPE ) { if ( IS_REWRITE_SUBMATCH_ESCAPE( p[ 0 ] ) ) {
/* /*
* '%' marks the beginning of a new map * '%' marks the beginning of a new map
*/ */

View File

@ -55,7 +55,10 @@
*/ */
/* the '\' conflicts with slapd.conf parsing */ /* the '\' conflicts with slapd.conf parsing */
/* #define REWRITE_SUBMATCH_ESCAPE '\\' */ /* #define REWRITE_SUBMATCH_ESCAPE '\\' */
#define REWRITE_SUBMATCH_ESCAPE '%' #define REWRITE_SUBMATCH_ESCAPE_ORIG '%'
#define REWRITE_SUBMATCH_ESCAPE '$'
#define IS_REWRITE_SUBMATCH_ESCAPE(c) \
((c) == REWRITE_SUBMATCH_ESCAPE || (c) == REWRITE_SUBMATCH_ESCAPE_ORIG)
/* /*
* REGEX flags * REGEX flags

View File

@ -55,11 +55,11 @@ rewrite_subst_compile(
/* /*
* Keep only single escapes '%' * Keep only single escapes '%'
*/ */
if ( p[ 0 ] != REWRITE_SUBMATCH_ESCAPE ) { if ( !IS_REWRITE_SUBMATCH_ESCAPE( p[ 0 ] ) ) {
continue; continue;
} }
if ( p[ 1 ] == REWRITE_SUBMATCH_ESCAPE ) { if ( IS_REWRITE_SUBMATCH_ESCAPE( p[ 1 ] ) ) {
/* Pull &p[1] over p, including the trailing '\0' */ /* Pull &p[1] over p, including the trailing '\0' */
AC_MEMCPY((char *)p, &p[ 1 ], strlen( p ) ); AC_MEMCPY((char *)p, &p[ 1 ], strlen( p ) );
continue; continue;