summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-09-02 11:46:53 +0200
committerJule Anger <janger@samba.org>2022-09-06 08:08:12 +0000
commited1d01126160d49aea9088805120f95050510fe6 (patch)
treefcaf3157a09b4279f91adea62c874b8f43a8ed5a
parent930380d4746f57e3d8ae9b6e9b9e37fc12ad890d (diff)
downloadsamba-ed1d01126160d49aea9088805120f95050510fe6.tar.gz
smbd: Catch streams on non-stream shares
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 (cherry picked from commit 3a37e4155c3cd82388652f89b611f2c46fee8525) Autobuild-User(v4-17-test): Jule Anger <janger@samba.org> Autobuild-Date(v4-17-test): Tue Sep 6 08:08:12 UTC 2022 on sn-devel-184
-rw-r--r--selftest/knownfail.d/samba3.smb2.create_no_streams1
-rw-r--r--source3/smbd/filename.c6
-rw-r--r--source3/smbd/files.c10
3 files changed, 14 insertions, 3 deletions
diff --git a/selftest/knownfail.d/samba3.smb2.create_no_streams b/selftest/knownfail.d/samba3.smb2.create_no_streams
deleted file mode 100644
index c8476081f2d..00000000000
--- a/selftest/knownfail.d/samba3.smb2.create_no_streams
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smb2.create_no_streams.no_stream\(fileserver\)
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index ca94b7ec7f9..0be8e320ffa 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -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);
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index b494a8b789a..179c3e11a76 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -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