[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Wed Feb 15 10:41:03 UTC 2017


The branch, master has been updated
       via  129015d lib: Fix "is_case_sensitive" in "ms_fnmatch_protocol"' callers
      from  e08110e s3/rpc_server/mdssvc: add attribute "kMDItemContentType"

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 129015d1a664e97410fa5fe2aef6bd8c494ffb5b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 12 20:12:10 2017 +0100

    lib: Fix "is_case_sensitive" in "ms_fnmatch_protocol"' callers
    
    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 at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Wed Feb 15 11:40:32 CET 2017 on sn-devel-144

-----------------------------------------------------------------------

Summary of changes:
 source4/client/client.c                  | 22 ++++++----------------
 source4/ntvfs/cifs_posix_cli/svfs_util.c |  2 +-
 source4/ntvfs/posix/pvfs_dirlist.c       |  8 ++++----
 source4/ntvfs/simple/svfs_util.c         |  2 +-
 source4/torture/masktest.c               |  2 +-
 5 files changed, 13 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/client/client.c b/source4/client/client.c
index 10d027b..1182e5b 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -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, 
 		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);
 }
 
 
diff --git a/source4/ntvfs/cifs_posix_cli/svfs_util.c b/source4/ntvfs/cifs_posix_cli/svfs_util.c
index ec2e933..0efab83 100644
--- a/source4/ntvfs/cifs_posix_cli/svfs_util.c
+++ b/source4/ntvfs/cifs_posix_cli/svfs_util.c
@@ -106,7 +106,7 @@ struct cifspsx_dir *cifspsx_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request
 
 		/* check it matches the wildcard pattern */
 		if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1,
-					true) != 0) {
+					false) != 0) {
 			continue;
 		}
 		
diff --git a/source4/ntvfs/posix/pvfs_dirlist.c b/source4/ntvfs/posix/pvfs_dirlist.c
index d86fce4..a503404 100644
--- a/source4/ntvfs/posix/pvfs_dirlist.c
+++ b/source4/ntvfs/posix/pvfs_dirlist.c
@@ -200,7 +200,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs)
 		(*ofs) = DIR_OFFSET_DOTDOT;
 		dir->offset = *ofs;
 		if (ms_fnmatch_protocol(dir->pattern, ".", protocol,
-					true) == 0) {
+					false) == 0) {
 			dcache_add(dir, ".");
 			return ".";
 		}
@@ -210,7 +210,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs)
 		(*ofs) = DIR_OFFSET_BASE;
 		dir->offset = *ofs;
 		if (ms_fnmatch_protocol(dir->pattern, "..", protocol,
-					true) == 0) {
+					false) == 0) {
 			dcache_add(dir, "..");
 			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,
-					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;
 			}
diff --git a/source4/ntvfs/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c
index 21f20c5..d1901ae 100644
--- a/source4/ntvfs/simple/svfs_util.c
+++ b/source4/ntvfs/simple/svfs_util.c
@@ -102,7 +102,7 @@ struct svfs_dir *svfs_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request *req,
 
 		/* check it matches the wildcard pattern */
 		if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1,
-					true) != 0) {
+					false) != 0) {
 			continue;
 		}
 		
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index e6e7f4e..2097de4 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -50,7 +50,7 @@ static bool reg_match_one(struct smbcli_state *cli, const char *pattern, const c
 	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)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list