summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-18 08:12:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:48 -0500
commitb3da2c10e268b9d4fe621ec21ab39e4aa45795e9 (patch)
treef23c853312f23f570293b6c9c0a3b0a4b16d9906
parenta502c85fb12915f9de9b664c6469942ce666c327 (diff)
downloadsamba-b3da2c10e268b9d4fe621ec21ab39e4aa45795e9.tar.gz
samba-b3da2c10e268b9d4fe621ec21ab39e4aa45795e9.tar.bz2
samba-b3da2c10e268b9d4fe621ec21ab39e4aa45795e9.zip
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)
-rw-r--r--source4/lib/ms_fnmatch.c6
1 files 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++;
}
}