[PATCH 8/8] smbd/open: disable compression with FILE_NO_COMPRESSION

David Disseldorp ddiss at samba.org
Mon Sep 16 09:52:53 CEST 2013


Files and directories created with FILE_NO_COMPRESSION should not
inherit the compression attribute from their parent directory.

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

diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 1a86233..54f85d8 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"
@@ -3963,6 +3964,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, NULL,
+						 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;
-- 
1.8.1.4



More information about the samba-technical mailing list