s3: vfs: vfs_streams_xattr: Don't blindly re-use the base file mode bits.
authorJeremy Allison <jra@samba.org>
Wed, 11 Apr 2018 15:41:00 +0000 (08:41 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 11 Apr 2018 21:09:12 +0000 (23:09 +0200)
commit4d839d0f46b723ed6809bb932b9ebe4ead2cec82
tree475099502bde7a0fa504a7019c6b174a43f8ddc2
parentdff196a15735ea4dd6946aa6f2efa8a7e8f54b77
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>
source3/modules/vfs_streams_xattr.c