smbd: ignore request to set the SPARSE attribute on streams
authorRalph Boehme <slow@samba.org>
Fri, 29 Jul 2022 12:56:41 +0000 (14:56 +0200)
committerJule Anger <janger@samba.org>
Tue, 6 Sep 2022 07:54:13 +0000 (07:54 +0000)
As per MS-FSA 2.1.1.5 this is a per stream attribute, but our backends don't
support it in a consistent way, therefor just pretend success and ignore the
request.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 3af8f8e8741cc8c889bbf416ccd38a1b702917ec)

source3/smbd/dosmode.c

index 06727de600caa4f4195725a6e9a322e71f0255a7..0cf418330492cc5952375ca4d72b92e478701ac0 100644 (file)
@@ -1133,6 +1133,19 @@ NTSTATUS file_set_sparse(connection_struct *conn,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
+       if (fsp_is_alternate_stream(fsp)) {
+               /*
+                * MS-FSA 2.1.1.5 IsSparse
+                *
+                * This is a per stream attribute, but our backends don't
+                * support it a consistent way, therefor just pretend
+                * success and ignore the request.
+                */
+               DBG_DEBUG("Ignoring request to set FILE_ATTRIBUTE_SPARSE on "
+                         "[%s]\n", fsp_str_dbg(fsp));
+               return NT_STATUS_OK;
+       }
+
        DEBUG(10,("file_set_sparse: setting sparse bit %u on file %s\n",
                  sparse, smb_fname_str_dbg(fsp->fsp_name)));