mangling + wildcards

Jeremy Allison jra at
Tue Sep 12 01:17:07 GMT 2006

On Mon, Sep 11, 2006 at 03:01:03PM +0300, Shlomi Yaakobovich wrote:
> 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 ?

Ok, this is a subtle one involving bugs in smbd/dir.c
(optimisation error :-) and in smbd/trans2.c. I'll
fix this..... Expect a patch once I've reached my
travel destination :-).


More information about the samba-technical mailing list