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)
committerVolker Lendecke <vl@samba.org>
Wed, 10 Aug 2022 15:32:35 +0000 (15:32 +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>
source3/smbd/dosmode.c

index dd07b5f38823cdb8185f1459a8dfdde8303bb2c2..3d69a35b3660c0aa8d9bbaacdc0bf9d61ab6945a 100644 (file)
@@ -1102,6 +1102,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)));