]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: check for streams support in unix_convert()
authorRalph Boehme <slow@samba.org>
Thu, 1 Sep 2022 16:55:52 +0000 (18:55 +0200)
committerJule Anger <janger@samba.org>
Tue, 6 Sep 2022 07:31:51 +0000 (07:31 +0000)
Fixes a regression introduced by the fixes for bug 15126 where we crash in
vfs_default in vfswrap_stat():

  assert failed: !is_named_stream(smb_fname)

The frontend calls into the VFS from build_stream_path() with a stream path
without checking if the share supports streams.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
[slow@samba.org: change from master adapted for unix_convert()]

Autobuild-User(v4-15-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-15-test): Tue Sep  6 07:31:51 UTC 2022 on sn-devel-184

selftest/knownfail.d/samba3.smb2.create_no_streams [deleted file]
source3/smbd/filename.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 ad9a0e817ffb37861eab44424487871988e5ebee..d716bc96d81070dd55a7d5c59e7860e6d53cfc62 100644 (file)
@@ -1033,7 +1033,14 @@ NTSTATUS unix_convert(TALLOC_CTX *mem_ctx,
                state->stream = strchr_m(state->smb_fname->base_name, ':');
 
                if (state->stream != NULL) {
-                       char *tmp = talloc_strdup(state->smb_fname, state->stream);
+                       char *tmp = NULL;
+
+                       if (!(conn->fs_capabilities & FILE_NAMED_STREAMS)) {
+                               status = NT_STATUS_OBJECT_NAME_INVALID;
+                               goto err;
+                       }
+
+                       tmp = talloc_strdup(state->smb_fname, state->stream);
                        if (tmp == NULL) {
                                status = NT_STATUS_NO_MEMORY;
                                goto err;