From b3da2c10e268b9d4fe621ec21ab39e4aa45795e9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 18 Sep 2004 08:12:55 +0000 Subject: r2400: make ms_fnmatch() case insensitive. This is much more efficient than uppercasing the two whole strings before the call is made, is less error-prone, and also copes with strings where the upper case version is longer than the lower case version due to different multi-byte lengths. (This used to be commit e227ac1edfd48596a9d5096b6965ddd0beb969a5) --- source4/lib/ms_fnmatch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source4/lib/ms_fnmatch.c b/source4/lib/ms_fnmatch.c index 1c4b3d1806..5a9edc2c87 100644 --- a/source4/lib/ms_fnmatch.c +++ b/source4/lib/ms_fnmatch.c @@ -94,7 +94,8 @@ static int ms_fnmatch_lanman_core(const smb_ucs2_t *pattern, break; default: - if (c != *n) goto nomatch; + if (c != *n && + toupper_w(c) != toupper_w(*n)) goto nomatch; n++; } } @@ -198,7 +199,8 @@ static int ms_fnmatch_w(const smb_ucs2_t *pattern, const smb_ucs2_t *string, break; default: - if (c != *n) return -1; + if (c != *n && + toupper_w(c) != toupper_w(*n)) return -1; n++; } } -- cgit