mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
lib: Fix "is_case_sensitive" in "ms_fnmatch_protocol"' callers
In the optimization in f969be5441
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
This commit is contained in:
parent
e08110ece6
commit
129015d1a6
@ -302,27 +302,17 @@ static int cmd_cd(struct smbclient_context *ctx, const char **args)
|
|||||||
static bool mask_match(struct smbcli_state *c, const char *string,
|
static bool mask_match(struct smbcli_state *c, const char *string,
|
||||||
const char *pattern, bool is_case_sensitive)
|
const char *pattern, bool is_case_sensitive)
|
||||||
{
|
{
|
||||||
char *p2, *s2;
|
int ret;
|
||||||
bool ret;
|
|
||||||
|
|
||||||
if (ISDOTDOT(string))
|
if (ISDOTDOT(string))
|
||||||
string = ".";
|
string = ".";
|
||||||
if (ISDOT(pattern))
|
if (ISDOT(pattern))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (is_case_sensitive)
|
ret = ms_fnmatch_protocol(pattern, string,
|
||||||
return ms_fnmatch_protocol(
|
c->transport->negotiate.protocol,
|
||||||
pattern, string, c->transport->negotiate.protocol,
|
is_case_sensitive);
|
||||||
true) == 0;
|
return (ret == 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ struct cifspsx_dir *cifspsx_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request
|
|||||||
|
|
||||||
/* check it matches the wildcard pattern */
|
/* check it matches the wildcard pattern */
|
||||||
if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1,
|
if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1,
|
||||||
true) != 0) {
|
false) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs)
|
|||||||
(*ofs) = DIR_OFFSET_DOTDOT;
|
(*ofs) = DIR_OFFSET_DOTDOT;
|
||||||
dir->offset = *ofs;
|
dir->offset = *ofs;
|
||||||
if (ms_fnmatch_protocol(dir->pattern, ".", protocol,
|
if (ms_fnmatch_protocol(dir->pattern, ".", protocol,
|
||||||
true) == 0) {
|
false) == 0) {
|
||||||
dcache_add(dir, ".");
|
dcache_add(dir, ".");
|
||||||
return ".";
|
return ".";
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs)
|
|||||||
(*ofs) = DIR_OFFSET_BASE;
|
(*ofs) = DIR_OFFSET_BASE;
|
||||||
dir->offset = *ofs;
|
dir->offset = *ofs;
|
||||||
if (ms_fnmatch_protocol(dir->pattern, "..", protocol,
|
if (ms_fnmatch_protocol(dir->pattern, "..", protocol,
|
||||||
true) == 0) {
|
false) == 0) {
|
||||||
dcache_add(dir, "..");
|
dcache_add(dir, "..");
|
||||||
return "..";
|
return "..";
|
||||||
}
|
}
|
||||||
@ -231,11 +231,11 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ms_fnmatch_protocol(dir->pattern, dname, protocol,
|
if (ms_fnmatch_protocol(dir->pattern, dname, protocol,
|
||||||
true) != 0) {
|
false) != 0) {
|
||||||
char *short_name = pvfs_short_name_component(dir->pvfs, dname);
|
char *short_name = pvfs_short_name_component(dir->pvfs, dname);
|
||||||
if (short_name == NULL ||
|
if (short_name == NULL ||
|
||||||
ms_fnmatch_protocol(dir->pattern, short_name,
|
ms_fnmatch_protocol(dir->pattern, short_name,
|
||||||
protocol, true) != 0) {
|
protocol, false) != 0) {
|
||||||
talloc_free(short_name);
|
talloc_free(short_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ struct svfs_dir *svfs_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request *req,
|
|||||||
|
|
||||||
/* check it matches the wildcard pattern */
|
/* check it matches the wildcard pattern */
|
||||||
if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1,
|
if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1,
|
||||||
true) != 0) {
|
false) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ static bool reg_match_one(struct smbcli_state *cli, const char *pattern, const c
|
|||||||
if (ISDOTDOT(file)) file = ".";
|
if (ISDOTDOT(file)) file = ".";
|
||||||
|
|
||||||
return ms_fnmatch_protocol(
|
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)
|
static char *reg_test(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *pattern, const char *long_name, const char *short_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user