From 7a1000222877cdbc8967122b9de29021a42f4c8a Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Tue, 4 Oct 2016 01:09:37 +0200 Subject: [PATCH] smbd/ioctl: match WS2016 ReFS get compression behaviour ReFS doesn't support compression, but responds to get-compression FSCTLs with a successful COMPRESSION_FORMAT_NONE response. set-compression results in NT_STATUS_NOT_SUPPORTED. This commit modifies Samba to match the ReFS behaviour, when run atop a VFS that doesn't expose compression support. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12144 Reported-by: Nick Barrett Signed-off-by: David Disseldorp Reviewed-by: Jeremy Allison --- source3/smbd/smb2_ioctl_filesys.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/source3/smbd/smb2_ioctl_filesys.c b/source3/smbd/smb2_ioctl_filesys.c index 6e4a7856b06..55ce3f24c01 100644 --- a/source3/smbd/smb2_ioctl_filesys.c +++ b/source3/smbd/smb2_ioctl_filesys.c @@ -48,19 +48,24 @@ static NTSTATUS fsctl_get_cmprn(TALLOC_CTX *mem_ctx, /* Windows doesn't check for SEC_FILE_READ_ATTRIBUTE permission here */ - if ((fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) == 0) { - DEBUG(4, ("FS does not advertise compression support\n")); - return NT_STATUS_NOT_SUPPORTED; - } - ZERO_STRUCT(cmpr_state); - status = SMB_VFS_GET_COMPRESSION(fsp->conn, - mem_ctx, - fsp, - NULL, - &cmpr_state.format); - if (!NT_STATUS_IS_OK(status)) { - return status; + if (fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) { + status = SMB_VFS_GET_COMPRESSION(fsp->conn, + mem_ctx, + fsp, + NULL, + &cmpr_state.format); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + } else { + /* + * bso#12144: The underlying filesystem doesn't support + * compression, so we should respond with "not-compressed" + * (like WS2016 ReFS) instead of STATUS_NOT_SUPPORTED or + * NT_STATUS_INVALID_DEVICE_REQUEST. + */ + cmpr_state.format = COMPRESSION_FORMAT_NONE; } ndr_ret = ndr_push_struct_blob(&output, mem_ctx, -- 2.11.4.GIT