Samba 3.0.20 - findfirst optimization

Dina Fine dina at exanet.com
Sun Oct 30 11:41:31 GMT 2005


Still FindFirst on mangled names doesn't work well both in case
sensitive = yes and case sensitive = no.
If the mangled name (as in the example below) is test<>.txt and you have
also test().txt in the same directory,
_unix_convert converts the name TKEIRY~Z.TXT to test<>.txt but
mask_match() (called from get_lanman2_entry) returns true for test<>.txt
and test().txt (due to <> chars in test<>.txt name)

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

So when findfirst requests for TKEIRY~Z.TXT, samba returns two files:
test().txt and test<>.txt which is not good.
Tcpdump:
Transaction2 request FIND_FIRST2, Pattern: \TKEIRY~Z.TXT
Transaction2 response FIND_FIRST2, Files: test().txt TKEIRY~Z.TXT

Dina Fine
ExaNet

-----Original Message-----
From: Jeremy Allison [mailto:jra at samba.org] 
Sent: Friday, October 28, 2005 3:34 AM
To: Dina Fine; g at samba.org
Cc: Jeremy Allison; samba-technical at lists.samba.org
Subject: Re: Samba 3.0.20 - findfirst optimization

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.


More information about the samba-technical mailing list