mangling + wildcards

Jeremy Allison jra at samba.org
Tue Sep 12 00:35:16 GMT 2006


On Mon, Sep 11, 2006 at 03:01:03PM +0300, Shlomi Yaakobovich wrote:
> Hi,
> 
> We've seen a strange behavior with mangling, and wildcards involved too.
> 
> The scenario: Mangling is enabled, case sensitivity is disabled. 2 files exist on the directory:
> 
> aaabbb.txt
> aaa*bbb.txt
> 
> The user (Windows XP) sees one file correctly (aaabbb.txt) and one file mangled. He then attempts to open the mangled file with wordpad, the file that actually gets opened is the unmangled file.
> 
> Looking at the tcpdump (attached) we see that find_first returns 2 files, and then the client chooses the first one (arbitrarily ?). However, the client did not ask for a search pattern, he wanted a specific file, and still samba did the search and found 2 files matching the "pattern".
> 
> In the code it appears that the mangling flag is not checked in get_lanman2_dir_entry:
> 
> >>>  if(!(got_match = *got_exact_match = exact_match(newname, mask, conn->case_sensitive)))
> >>>	got_match = mask_match(newname, mask, conn->case_sensitive);
> 
> In all these checks, if we did not find an exact_match, we should not attempt a mask_match, if the file name was originally mangled !  The problem with the existing code is that get_lanman2_dir_entry does not know if the file was originally mangled (this is done somewhere in unix_convert).
> 
> Any ideas on how to fix this cleanly ?  Add a flag to unix_convert and  get_lanman2_dir_entry ?

I'll try and take a look on this whilst I'm on my
Paris trip.

Jeremy.


More information about the samba-technical mailing list