Samba 3.0.20 - findfirst optimization
Jeremy Allison
jra at samba.org
Fri Oct 28 01:34:17 GMT 2005
On Wed, Oct 26, 2005 at 09:46:37AM +0200, Dina Fine wrote:
> Hi Jeremy
>
> I configured case sensitive = yes, mangled names = yes. Find First fails
> to get an existing mangled file:
> S:\>dir shlomi\
> Volume in drive S is c$
> Volume Serial Number is 2629-002B
>
> Directory of S:\shlomi
>
> 10/26/2005 09:04 AM <DIR> .
> 10/26/2005 09:21 AM <DIR> ..
> 10/26/2005 09:03 AM 5 test().txt
> 10/26/2005 09:04 AM 5 TKEIRY~Z.TXT
> 10/26/2005 09:03 AM 6 hello.txt
> 3 File(s) 16 bytes
> 2 Dir(s) 360,156,233,728 bytes free
>
> S:\>type shlomi\TKEIRY~Z.TXT
> The system cannot find the file specified.
Here is the fix I've checked in. It's actually a "resolving a
mangled name in statcache lookup" bug not a findfirst problem
in the directory code.
Jeremy.
-------------- next part --------------
Index: smbd/filename.c
===================================================================
--- smbd/filename.c (revision 11342)
+++ smbd/filename.c (working copy)
@@ -445,9 +445,18 @@
* read from the directory and then mangled by the mangle_map()
* call. We need to mangle both names or neither.
* (JRA).
+ *
+ * Fix for bug found by Dina Fine. If in case sensitive mode then
+ * the mangle cache is no good (3 letter extension could be wrong
+ * case - so don't demangle in this case - leave as mangled and
+ * allow the mangling of the directory entry read (which is done
+ * case insensitively) to match instead. This will lead to more
+ * false positive matches but we fail completely without it. JRA.
*/
- if (mangled)
+
+ if (mangled && !conn->case_sensitive) {
mangled = !mangle_check_cache( name, maxlength, SNUM(conn));
+ }
/* open the directory */
if (!(cur_dir = OpenDir(conn, path, NULL, 0))) {
More information about the samba-technical
mailing list