From 9a3d4d484e0868d9174f37a8dfd9efd4e77c044d Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Mon, 18 Nov 2013 14:54:37 +0100 Subject: [PATCH] smbd/open: disable compression with FILE_NO_COMPRESSION Files and directories created with FILE_NO_COMPRESSION should not inherit the compression attribute from their parent directory. Signed-off-by: David Disseldorp Reviewed-by: Jeremy Allison --- source3/smbd/open.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 105eb09530f..5370cb8ab11 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -29,6 +29,7 @@ #include "../librpc/gen_ndr/ndr_security.h" #include "../librpc/gen_ndr/open_files.h" #include "../librpc/gen_ndr/idmap.h" +#include "../librpc/gen_ndr/ioctl.h" #include "passdb/lookup_sid.h" #include "auth.h" #include "serverid.h" @@ -4067,6 +4068,17 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, } } + if ((conn->fs_capabilities & FILE_FILE_COMPRESSION) + && (create_options & FILE_NO_COMPRESSION) + && (info == FILE_WAS_CREATED)) { + status = SMB_VFS_SET_COMPRESSION(conn, fsp, fsp, + COMPRESSION_FORMAT_NONE); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("failed to disable compression: %s\n", + nt_errstr(status))); + } + } + DEBUG(10, ("create_file_unixpath: info=%d\n", info)); *result = fsp; -- 2.11.4.GIT