]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Catch streams on non-stream shares
authorVolker Lendecke <vl@samba.org>
Fri, 2 Sep 2022 09:46:53 +0000 (11:46 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 2 Sep 2022 15:56:56 +0000 (15:56 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15161

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Sep  2 15:56:56 UTC 2022 on sn-devel-184

selftest/knownfail.d/samba3.smb2.create_no_streams [deleted file]
source3/smbd/filename.c
source3/smbd/files.c

diff --git a/selftest/knownfail.d/samba3.smb2.create_no_streams b/selftest/knownfail.d/samba3.smb2.create_no_streams
deleted file mode 100644 (file)
index c847608..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smb2.create_no_streams.no_stream\(fileserver\)
index ca94b7ec7f96e64f13719fb0fe5a4a5b3616e5c2..0be8e320ffa02d765a1c8f47e3aa7135039cedc5 100644 (file)
@@ -1120,6 +1120,12 @@ static NTSTATUS filename_convert_dirfsp_nosymlink(
                goto fail;
        }
 
+       if ((streamname != NULL) &&
+           ((conn->fs_capabilities & FILE_NAMED_STREAMS) == 0)) {
+               status = NT_STATUS_OBJECT_NAME_INVALID;
+               goto fail;
+       }
+
        if (!posix) {
                bool name_has_wild = ms_has_wild(dirname);
                name_has_wild |= ms_has_wild(fname_rel);
index 095a01723b1a53549c0b1fce78c5afdf439b9ce5..e7c8350532814ae8f95341aab9d52591ec01a704 100644 (file)
@@ -565,8 +565,14 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
                return NT_STATUS_OK;
        }
 
-       if (!(conn->fs_capabilities & FILE_NAMED_STREAMS) ||
-           !is_named_stream(smb_fname)) {
+       if (is_named_stream(smb_fname) &&
+           ((conn->fs_capabilities & FILE_NAMED_STREAMS) == 0)) {
+               DBG_DEBUG("stream open [%s] on non-stream share\n",
+                         smb_fname_str_dbg(smb_fname));
+               return NT_STATUS_OBJECT_NAME_INVALID;
+       }
+
+       if (!is_named_stream(smb_fname)) {
                /*
                 * openat_pathref_fullname() will make "full_fname" a
                 * talloc child of the smb_fname->fsp. Don't use