In the optimization in
f969be54417 I got the boolean flag "is_case_sensitive"
wrong. The behaviour was case *insensitive*, so all the flags should have been
"false", keeping the old behaviour. While there, simplify "mask_match" in
source4 client.c
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Feb 15 11:40:32 CET 2017 on sn-devel-144
static bool mask_match(struct smbcli_state *c, const char *string,
const char *pattern, bool is_case_sensitive)
{
- char *p2, *s2;
- bool ret;
+ int ret;
if (ISDOTDOT(string))
string = ".";
if (ISDOT(pattern))
return false;
-
- if (is_case_sensitive)
- return ms_fnmatch_protocol(
- pattern, string, c->transport->negotiate.protocol,
- true) == 0;
-
- p2 = strlower_talloc(NULL, pattern);
- s2 = strlower_talloc(NULL, string);
- ret = ms_fnmatch_protocol(p2, s2, c->transport->negotiate.protocol,
- true) == 0;
- talloc_free(p2);
- talloc_free(s2);
-
- return ret;
+
+ ret = ms_fnmatch_protocol(pattern, string,
+ c->transport->negotiate.protocol,
+ is_case_sensitive);
+ return (ret == 0);
}
/* check it matches the wildcard pattern */
if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1,
- true) != 0) {
+ false) != 0) {
continue;
}
(*ofs) = DIR_OFFSET_DOTDOT;
dir->offset = *ofs;
if (ms_fnmatch_protocol(dir->pattern, ".", protocol,
- true) == 0) {
+ false) == 0) {
dcache_add(dir, ".");
return ".";
}
(*ofs) = DIR_OFFSET_BASE;
dir->offset = *ofs;
if (ms_fnmatch_protocol(dir->pattern, "..", protocol,
- true) == 0) {
+ false) == 0) {
dcache_add(dir, "..");
return "..";
}
}
if (ms_fnmatch_protocol(dir->pattern, dname, protocol,
- true) != 0) {
+ false) != 0) {
char *short_name = pvfs_short_name_component(dir->pvfs, dname);
if (short_name == NULL ||
ms_fnmatch_protocol(dir->pattern, short_name,
- protocol, true) != 0) {
+ protocol, false) != 0) {
talloc_free(short_name);
continue;
}
/* check it matches the wildcard pattern */
if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1,
- true) != 0) {
+ false) != 0) {
continue;
}
if (ISDOTDOT(file)) file = ".";
return ms_fnmatch_protocol(
- pattern, file, cli->transport->negotiate.protocol, true)==0;
+ pattern, file, cli->transport->negotiate.protocol, false)==0;
}
static char *reg_test(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *pattern, const char *long_name, const char *short_name)