[SCM] Samba Shared Repository - branch master updated - 6ce29dc9add1252b0ded9d2c1c2b6bae74604cc4

Jeremy Allison jra at samba.org
Tue Nov 18 18:14:40 GMT 2008


On Tue, Nov 18, 2008 at 10:00:48AM -0600, Volker Lendecke wrote:
> The branch, master has been updated
>        via  6ce29dc9add1252b0ded9d2c1c2b6bae74604cc4 (commit)
>       from  6ef719bf92f6a6b9cdbd35d6b9c6e9d4d4f0dde5 (commit)
> 
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
> 
> 
> - Log -----------------------------------------------------------------
> commit 6ce29dc9add1252b0ded9d2c1c2b6bae74604cc4
> Author: Volker Lendecke <vl at samba.org>
> Date:   Tue Nov 18 17:03:38 2008 +0100
> 
>     Fix trans2findfirst for the large directory optimization
>     
>     With
>     
>     case sensitive = yes
>     preserve case = no
>     short preserve case = no
>     default case = upper
>     
>     a "dir FOO.txt" would not find "FOO.TXT" because FOO.txt ends up unconverted in
>     the mask for mask_match.
>     
>     Jeremy, please check!

Really good catch ! However I think the attached patch
might restructure the code a little better and make
the intent clearer. Applies to the original code
(not your patched version).

Can you check it out ? Thanks,

Jeremy.
-------------- next part --------------
diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index 562f1e8..87579f9 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -194,24 +194,39 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 		return result;
 	}
 
+	if (!(name = talloc_strdup(ctx, orig_path))) {
+		DEBUG(0, ("talloc_strdup failed\n"));
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	/*
+	 * Large directory fix normalization. If we're case sensitive, and
+	 * the case preserving parameters are set to "no", normalize the case of
+	 * the incoming filename from the client WHETHER IT EXISTS OR NOT !
+	 * This is in conflict with the current (3.0.20) man page, but is
+	 * what people expect from the "large directory howto". I'll update
+	 * the man page. Thanks to jht at samba.org for finding this. JRA.
+	 */
+
+	if (conn->case_sensitive && !conn->case_preserve &&
+			!conn->short_case_preserve) {
+		strnorm(name, lp_defaultcase(SNUM(conn)));
+	}
+
 	/*
 	 * Ensure saved_last_component is valid even if file exists.
 	 */
 
 	if(pp_saved_last_component) {
-		end = strrchr_m(orig_path, '/');
+		end = strrchr_m(name, '/');
 		if (end) {
 			*pp_saved_last_component = talloc_strdup(ctx, end + 1);
 		} else {
 			*pp_saved_last_component = talloc_strdup(ctx,
-							orig_path);
+							name);
 		}
 	}
 
-	if (!(name = talloc_strdup(ctx, orig_path))) {
-		DEBUG(0, ("talloc_strdup failed\n"));
-		return NT_STATUS_NO_MEMORY;
-	}
 
 	if (!lp_posix_pathnames()) {
 		stream = strchr_m(name, ':');
@@ -227,20 +242,6 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 		}
 	}
 
-	/*
-	 * Large directory fix normalization. If we're case sensitive, and
-	 * the case preserving parameters are set to "no", normalize the case of
-	 * the incoming filename from the client WHETHER IT EXISTS OR NOT !
-	 * This is in conflict with the current (3.0.20) man page, but is
-	 * what people expect from the "large directory howto". I'll update
-	 * the man page. Thanks to jht at samba.org for finding this. JRA.
-	 */
-
-	if (conn->case_sensitive && !conn->case_preserve &&
-			!conn->short_case_preserve) {
-		strnorm(name, lp_defaultcase(SNUM(conn)));
-	}
-
 	start = name;
 
 	/* If we're providing case insentive semantics or


More information about the samba-technical mailing list