From b433e4c852a2ef78558dffc1ccbaf464c1186934 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Wed, 7 Apr 2010 10:16:22 -0600 Subject: Bug 572162 - the string "|*" within a search filter on a non-indexed attribute returns all elements. https://bugzilla.redhat.com/show_bug.cgi?id=572162 Resolves: bug 572162 Bug Description: the string "|*" within a search filter on a non-indexed attribute returns all elements. Reviewed by: nhosoi (Thanks!) Branch: HEAD Fix Description: PCRE interprets the '|' character as the start of alternative branch. In the search filter, the other side of the '|' is empty, which means match everything. The solution is to escape this and other PCRE special chars before matching. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no --- ldap/servers/plugins/syntaxes/string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ldap/servers/plugins/syntaxes/string.c') diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c index dd44a808..9b338335 100644 --- a/ldap/servers/plugins/syntaxes/string.c +++ b/ldap/servers/plugins/syntaxes/string.c @@ -262,7 +262,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final, if ( initial != NULL ) { value_normalize( initial, syntax, 1 /* trim leading blanks */ ); *p++ = '^'; - filter_strcpy_special_ext( p, initial, FILTER_STRCPY_ESCAPE_PARENS ); + filter_strcpy_special_ext( p, initial, FILTER_STRCPY_ESCAPE_RECHARS ); p = strchr( p, '\0' ); } if ( any != NULL ) { @@ -271,7 +271,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final, /* ".*" + value */ *p++ = '.'; *p++ = '*'; - filter_strcpy_special_ext( p, any[i], FILTER_STRCPY_ESCAPE_PARENS ); + filter_strcpy_special_ext( p, any[i], FILTER_STRCPY_ESCAPE_RECHARS ); p = strchr( p, '\0' ); } } @@ -280,7 +280,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final, /* ".*" + value */ *p++ = '.'; *p++ = '*'; - filter_strcpy_special_ext( p, final, FILTER_STRCPY_ESCAPE_PARENS ); + filter_strcpy_special_ext( p, final, FILTER_STRCPY_ESCAPE_RECHARS ); strcat( p, "$" ); } -- cgit