mangling + wildcards

Shlomi Yaakobovich Shlomi at
Mon Sep 11 12:01:03 GMT 2006


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:


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 ?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mangled_with_wordpad.pcap
Type: application/octet-stream
Size: 31629 bytes
Desc: mangled_with_wordpad.pcap
Url :

More information about the samba-technical mailing list