From windows I am calling: FindFirstFile("\\\\host\\share\\A89XZ5~O\\AL6KKN~L", &fData); Where: "A89XZ5~O" is the mangled directory "a_test\dir" "AL6KKN~L" is the mangled file "a_test\file" and am getting error 2, ERROR_FILE_NOT_FOUND. The problem seems to be (from my naive look at the log/source) that SAMBA de-mangles the 'search pattern' "AL6KKN~L" to "a_test\file" but then mangles the directory contents before comparrison such that it fails to locate the file. Matching against the mangled names makes sense because those are the results which will be returned and it would look odd to get results that did not appear to match the search pattern. But a mangled search pattern that matches a filename exactly should really result in a hit. In which case I think there are 2 possible solutions: 1. It should not be de-mangling the search pattern 2. It should perform a special case check for a de-mangled search pattern that matches an un-mangled filename exactly. The log follows... [2008/09/19 08:05:22, 3] smbd/trans2.c:call_trans2findfirst(1918) call_trans2findfirst: dirtype = 16, maxentries = 1366, close_after_first=1, close_if_end = 1 requires_resume_key = 1 level = 0x104, max_data_bytes = 16384 [2008/09/19 08:05:22, 5] smbd/filename.c:unix_convert(149) unix_convert called on file "A89XZ5~O/AL6KKN~L" [2008/09/19 08:05:22, 5] smbd/filename.c:unix_convert(296) unix_convert begin: name = A89XZ5~O/AL6KKN~L, dirpath = , start = A89XZ5~O/AL6KKN~L [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled(249) is_mangled A89XZ5~O/AL6KKN~L ? [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled_component(188) is_mangled_component A89XZ5~O/AL6KKN~L (len 8) ? [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled_component(226) is_mangled_component A89XZ5~O/AL6KKN~L (len 8) -> yes [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled(249) is_mangled A89XZ5~O/AL6KKN~L ? [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled_component(188) is_mangled_component A89XZ5~O/AL6KKN~L (len 8) ? [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled_component(226) is_mangled_component A89XZ5~O/AL6KKN~L (len 8) -> yes [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled(249) is_mangled A89XZ5~O ? [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled_component(188) is_mangled_component A89XZ5~O (len 8) ? [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled_component(226) is_mangled_component A89XZ5~O (len 8) -> yes [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:hash2_name_to_8_3(609) hash2_name_to_8_3: .htfs_cmdfile -> 678C8C57 -> _SQBLN~B (cache=0) [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:hash2_name_to_8_3(609) hash2_name_to_8_3: a_test\dir -> 1DD3F93C -> A89XZ5~O (cache=0) [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled(249) is_mangled AL6KKN~L ? [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled_component(188) is_mangled_component AL6KKN~L (len 8) ? [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:is_mangled_component(226) is_mangled_component AL6KKN~L (len 8) -> yes [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:hash2_name_to_8_3(609) hash2_name_to_8_3: a_test\file -> 4C57DF91 -> AL6KKN~L (cache=0) [2008/09/19 08:05:22, 5] smbd/filename.c:unix_convert(683) conversion finished A89XZ5~O/AL6KKN~L -> a_test\dir/a_test\file [2008/09/19 08:05:22, 5] smbd/trans2.c:call_trans2findfirst(2002) dir=a_test\dir, mask = a_test\file [2008/09/19 08:05:22, 5] smbd/dir.c:dptr_create(402) dptr_create dir=a_test\dir [2008/09/19 08:05:22, 3] smbd/dir.c:dptr_create(520) creating new dirptr 256 for path a_test\dir, expect_close = 1 [2008/09/19 08:05:22, 4] smbd/trans2.c:call_trans2findfirst(2069) dptr_num is 256, wcard = a_test\file, attr = 22 [2008/09/19 08:05:22, 8] smbd/trans2.c:call_trans2findfirst(2074) dirpath=<a_test\dir> dontdescend=<> [2008/09/19 08:05:22, 8] smbd/trans2.c:get_lanman2_dir_entry(1309) get_lanman2_dir_entry:readdir on dirptr 0x8a92890 now at offset -1 [2008/09/19 08:05:22, 10] smbd/mangle_hash2.c:hash2_name_to_8_3(609) hash2_name_to_8_3: a_test\file -> 4C57DF91 -> AL6KKN~L (cache=1) [2008/09/19 08:05:22, 8] smbd/trans2.c:get_lanman2_dir_entry(1309) get_lanman2_dir_entry:readdir on dirptr 0x8a92890 now at offset -1 [2008/09/19 08:05:22, 5] smbd/trans2.c:call_trans2findfirst(2130) call_trans2findfirst - (2) closing dptr_num 256 [2008/09/19 08:05:22, 4] smbd/dir.c:dptr_close_internal(251) closing dptr key 256 [2008/09/19 08:05:22, 3] smbd/error.c:error_packet_set(61) error packet at smbd/trans2.c(2148) cmd=50 (SMBtrans2) NT_STATUS_NO_SUCH_FILE
Created attachment 3615 [details] Proposed patch I think this will fix it. Give me a few mins to test and I'll check into all the 3.2.x branches. Jeremy.
Scratch that patch - won't work. Still working on this. Jeremy.
Created attachment 3616 [details] Proposed patch This one works. Phew - that's an *old* and subtle bug ! Jeremy
Applied, tested, is fixed for me.