s3: smbd: Fix a couple of tricky slow-path cases - don't return a mangled name for...
authorJeremy Allison <jra@samba.org>
Tue, 26 Aug 2014 23:39:56 +0000 (16:39 -0700)
committerDavid Disseldorp <ddiss@samba.org>
Mon, 15 Sep 2014 23:56:55 +0000 (01:56 +0200)
commit6d03aed15e1be4c126c2de4708d0b1cd112ba901
treebb9c51c3c3c9ddb7fa03c15a9cf240522ad06846
parent2fc8d0e0e85cd118f114f234a7eac3902d01c32e
s3: smbd: Fix a couple of tricky slow-path cases - don't return a mangled name for a name that cannot be converted.

For a name that contains an illegal Windows character, the
directory listing code returns the mangled 8.3 name as the
primary name for the file.

If the original (non-mangled) filename cannot be converted
to UCS2 on the wire via iconv due to conversion error, we
should skip that name when returning a directory listing,
as we can't map back from a returned 8.3 name to a usable
non-mangled filename if the client sends it back to us.

As this is only done in a very slow path (name must be mangled)
or in the old DOS protocol listing code I don't feel too bad
about using a talloc/free pair here.

Bug 10775 - smbd crashes when accessing garbage filenames

https://bugzilla.samba.org/show_bug.cgi?id=10775

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
source3/smbd/dir.c
source3/smbd/trans2.c