Skip to contentSkip to conversation

incomplete FIND_FIRST2 response and resulting cifs behavior

DISCUSSION Michael Kerscher 1 participant 1 message Dec 8, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

we found an issue which might be sourced in the cifs module and might only be triggered in a special case.

Our current situation:
We run a samba-4.1.13 (debian jessie) and in our share are some files with an iso 8859-1 encoding (e.g. test_ä_foo). There are some errors in the samba log like

[2014/12/07 20:00:52.353146, 0] ../lib/util/charset/convert_string.c:438(convert_string_talloc_handle)
Conversion error: Illegal multibyte sequence(ä_foo)

This is an issue I will also look into but the problem is, that samba responds to the FIND_FIRST2 request with an incomplete response. I attached a pcap with an example which I logged on my client. The requested directory (public/mytest) contained only a file named test_ä_foo (in iso 8859-1 encoding) so the response contained the . and .. directory entries and a file entry which is missing the file name field at the end of the packet. It just stops at the num links field.

A windows client just shows an empty filename in the explorer.

If mounted on linux with cifs then I see either random characters, some directory/file names of the parent directory (or other directories) or
ls: reading directory /mnt/tmp/public/mytest: Invalid argument On repeated calls of ls the filename changes to some other folder names.

E.g if my directory looks like
-> public
- test_file
- test_foo
-> mytest
- test_ä_foo
then $ ls public/mytest might have the following outputs:

$ ls public/mytest
<some_random_chars>
$ ls public/mytest
test_file
$ ls public/mytest
test_file
$ ls public/mytest
test_foo

which is not what I expected (test_ä_foo)

In the attached pcap log you can see a request where there should be included the directory entries ".", ".." and a file named "test_ä_foo".

If you need more details I'll be happy to provide them.

regards,
Michael