s3: vfs: vfs_streams_xattr: Don't blindly re-use the base file mode bits.
commitace735eb2b23896ad43bbf570be818a8ad533b58
authorJeremy Allison <jra@samba.org>
Wed, 11 Apr 2018 15:41:00 +0000 (11 08:41 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 7 May 2018 07:56:11 +0000 (7 09:56 +0200)
treec698771ea0bc47656bd68623083688ea5ac0a7c7
parent13f23ec11ef3c932b0cb2000613dfbc6dd14554b
s3: vfs: vfs_streams_xattr: Don't blindly re-use the base file mode bits.

When returning the stat struct for an xattr stream,
we originally base the st_ex_mode field on the value
from the base file containing the xattr. If the base
file is a directory, it will have S_IFDIR set in st_ex_mode,
but streams can never be directories, they must be reported
as regular files.

The original code OR'ed in S_IFREG, but neglected to
AND out S_IFDIR.

Note this is not a complete to fix bug 13380 as
it doesn't fix the generic case with all streams
modules. See later fix and regression test.

Found in real-world use case by Andrew Walker <awalker@ixsystems.com>.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
(cherry picked from commit 4d839d0f46b723ed6809bb932b9ebe4ead2cec82)
source3/modules/vfs_streams_xattr.c