summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2018-04-11 11:05:14 -0700
committerKarolin Seeger <kseeger@samba.org>2018-05-07 09:56:11 +0200
commit3d4a8f2c5f1f89415ae52539f3c99e6b0b52f020 (patch)
treed8e03327953a1eeb17220d84a7f04465a5195f08 /source3/smbd
parentace735eb2b23896ad43bbf570be818a8ad533b58 (diff)
downloadsamba-3d4a8f2c5f1f89415ae52539f3c99e6b0b52f020.tar.gz
s3: smbd. Generic fix for incorrect reporting of stream dos attributes on a directory
According to MS-FSA a stream name does not have separate DOS attribute metadata, so we must return the DOS attribute from the base filename. With one caveat, a non-default stream name can never be a directory. As this is common to all streams data stores, we handle it here instead of inside all stream VFS modules. Otherwise identical logic would have to be added to all streams modules in their [f]get_dos_attribute_fn() VFS calls. 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: Ralph Böhme <slow@samba.org> (cherry picked from commit 118e77d86a7171f589f805fa4f63246b0cb63672)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/dosmode.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 8a11c8fd62a..7ac876a47bf 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -681,6 +681,28 @@ uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname)
}
}
+ /*
+ * According to MS-FSA a stream name does not have
+ * separate DOS attribute metadata, so we must return
+ * the DOS attribute from the base filename. With one caveat,
+ * a non-default stream name can never be a directory.
+ *
+ * As this is common to all streams data stores, we handle
+ * it here instead of inside all stream VFS modules.
+ *
+ * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
+ */
+
+ if (is_ntfs_stream_smb_fname(smb_fname)) {
+ /* is_ntfs_stream_smb_fname() returns false for a POSIX path. */
+ if (!is_ntfs_default_stream_smb_fname(smb_fname)) {
+ /*
+ * Non-default stream name, not a posix path.
+ */
+ result &= ~(FILE_ATTRIBUTE_DIRECTORY);
+ }
+ }
+
if (conn->fs_capabilities & FILE_FILE_COMPRESSION) {
bool compressed = false;
status = dos_mode_check_compressed(conn, smb_fname,