Commit Graph
18 Commits
Author SHA1 Message Date
Andrew Tridgell ded4fb157e wildmatch: fold bracket-expression pattern chars under force_lower_case
dowild()'s literal path folds the pattern char, but the [class]/[a-z] path
compared unfolded pattern bytes against the (folded) text, so iwildmatch() was
still case-asymmetric for character classes and ranges -- e.g. a daemon
'hosts deny = [A-Z]*.EVIL.COM' failed to match a lower-case host (access-control
fail-open, same class as the literal case).  Fold p_ch for the escaped-member,
range-endpoint and plain-member comparisons; the range start (prev_ch) picks up
the folded value too.  Only active under force_lower_case (iwildmatch), so
case-sensitive wildmatch() is unchanged.

Reported-by: Leonid Bugaev
(cherry picked from commit d443e8dc93)
2026-07-20 14:18:38 +10:00
Wayne Davison 3d0a159d96 Added a comment to a shared iterator to avoid a warning from IBM's checker. 2007-05-22 05:58:59 +00:00
Wayne Davison 390621a7ab Added a new function, wildmatch_array(), that lets the caller pass
the text-string as an array of strings (with a terminating NULL
pointer at the end).  Also added litmatch_array(), which does a
literal match (no wildcards or special chars) against an array of
strings.
2006-01-02 17:46:15 +00:00
Wayne Davison 8e74463643 - Added a new public function, iwildmatch(), which will treat all
upper-case letters in the "text" as lower-case.
- Renamed variable "ch" -> "p_ch" and "prev" -> "prev_ch".
- Added variable "t_ch" to hold the current *text value.
- Return ABORT_ALL if we reach the end of the text string with
  more pattern to match.
2005-12-30 07:12:48 +00:00
Wayne Davison e725abcf4e Added a comment, improved a comment, tweaked the recursive function's
name, tweaked the arg names to wildmatch(), and tweaked the style of
the "else" statements when they follow a brace.
2005-12-18 19:40:50 +00:00
Wayne Davison 5f238db203 - Use "uchar" instead of "unsigned char".
- Tweaked an initializer to try to avoid a compiler warning.
2005-01-28 21:01:21 +00:00
Wayne Davison d811b68901 Make sure that no character class can match a '/'. 2003-07-14 15:12:59 +00:00
Wayne Davison 136c5c5ec3 Silence some compiler warnings on HP-UX. 2003-07-07 07:22:08 +00:00
Wayne Davison fc96552d26 Don't treat "[:" as the start of a named set if there's no ":]". 2003-07-07 07:07:16 +00:00
Wayne Davison 5bb920003e - Return ABORT_ALL for a syntax error in the pattern (not FALSE).
- Abort if the [:class:] name is not known.
2003-07-06 18:26:34 +00:00
Wayne Davison f2ac84c36d Added some portability code for the ctype functions. 2003-07-06 16:29:32 +00:00
Wayne Davison e11c425119 - Added [:class:] handling to the character-class code.
- Use explicit unsigned characters for proper set checks.
- Made the character-class code honor backslash escapes.
- Accept '^' as a class-negation character in addition to '!'.
2003-07-06 04:33:54 +00:00
Wayne Davison c9a59880f0 Simplified the character-class code a bit. 2003-07-05 22:40:27 +00:00
Wayne Davison d5c973ccb7 Changed some names since "depth" wasn't really the right term. 2003-07-05 19:03:42 +00:00
Wayne Davison 20b2e9cef7 Improved the ABORT logic to allow aborting consecutive "*" wildcards
back to a "**" wildcard.  Added optional debug code for recursion stats.
2003-07-05 18:48:34 +00:00
Wayne Davison 710faea9a4 Added in the ABORT optimization logic from a newer wildmat release,
adapted for our code that distinguishes "**" from "*".
2003-07-05 17:30:53 +00:00
Wayne Davison 7a1f46b6ac A couple comment tweaks. 2003-07-05 07:22:13 +00:00
Wayne Davison 446ee5b110 A new wildcard-matching routine to replace the fnmatch code. 2003-07-05 00:03:36 +00:00