[PATCH 4/6] dosmode: fix FSCTL_SET_SPARSE request validation

David Disseldorp ddiss at samba.org
Wed Aug 27 07:42:00 MDT 2014


Check that FSCTL_SET_SPARSE requests does not refer to directories. Also
reject such requests when issued over IPC or printer share connections.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10787

Signed-off-by: David Disseldorp <ddiss at samba.org>
---
 source3/smbd/dosmode.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 965e695..162684b 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -886,6 +886,19 @@ NTSTATUS file_set_sparse(connection_struct *conn,
 		return NT_STATUS_ACCESS_DENIED;
 	}
 
+	if (fsp->is_directory) {
+		DEBUG(9, ("invalid attempt to %s sparse flag on dir %s\n",
+			  (sparse ? "set" : "clear"),
+			  smb_fname_str_dbg(fsp->fsp_name)));
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
+	if (IS_IPC(conn) || IS_PRINT(conn)) {
+		DEBUG(9, ("attempt to %s sparse flag over invalid conn\n",
+			  (sparse ? "set" : "clear")));
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
 	DEBUG(10,("file_set_sparse: setting sparse bit %u on file %s\n",
 		  sparse, smb_fname_str_dbg(fsp->fsp_name)));
 
-- 
1.8.4.5



More information about the samba-technical mailing list