summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2014-08-27 15:42:00 +0200
committerKarolin Seeger <kseeger@samba.org>2014-09-01 21:34:12 +0200
commit121cad350d1ce45558e082b4b504a5aa72bf767c (patch)
treee723361f53d43087770062e20491d45bcefff0e7 /source3/smbd
parenta5f0ec0a6bbc747b5d368c98d2692c6c579c7b15 (diff)
downloadsamba-121cad350d1ce45558e082b4b504a5aa72bf767c.tar.gz
dosmode: fix FSCTL_SET_SPARSE request validation
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Aug 28 04:22:37 CEST 2014 on sn-devel-104 (cherry picked from commit 0751495b1327d002b79482632b7c590cae6e3f9d)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/dosmode.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index b99e18033c..baf40d7750 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -951,6 +951,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)));