The Samba-Bugzilla – Attachment 12539 Details for
Bug 12144
Incorrect response to FSCTL_SET_COMPRESSION request
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed fix - as send to samba-technical ML
compression-unsupported.patchset (text/plain), 5.73 KB, created by
David Disseldorp
on 2016-10-03 23:27:48 UTC
(
hide
)
Description:
proposed fix - as send to samba-technical ML
Filename:
MIME Type:
Creator:
David Disseldorp
Created:
2016-10-03 23:27:48 UTC
Size:
5.73 KB
patch
obsolete
>From 5756d8dbebce5e5f39caa5d547507bd290366d12 Mon Sep 17 00:00:00 2001 >From: David Disseldorp <ddiss@samba.org> >Date: Tue, 4 Oct 2016 01:09:37 +0200 >Subject: [PATCH 1/2] 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 <ddiss@samba.org> >--- > 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 6e4a785..55ce3f2 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.6.6 > > >From 9f46c073736dfe65184915ce2c1097716e386ce9 Mon Sep 17 00:00:00 2001 >From: David Disseldorp <ddiss@samba.org> >Date: Tue, 4 Oct 2016 01:15:20 +0200 >Subject: [PATCH 2/2] torture/ioctl: test compression responses when > unsupported > >Confirm that Samba matches Windows Server 2016 ReFS behaviour here. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=12144 > >Reported-by: Nick Barrett >Signed-off-by: David Disseldorp <ddiss@samba.org> >--- > source4/torture/smb2/ioctl.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 76 insertions(+) > >diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c >index 2baf7b6..01cc150 100644 >--- a/source4/torture/smb2/ioctl.c >+++ b/source4/torture/smb2/ioctl.c >@@ -2543,6 +2543,78 @@ static bool test_ioctl_compress_perms(struct torture_context *torture, > return true; > } > >+static bool test_ioctl_compress_notsup_get(struct torture_context *torture, >+ struct smb2_tree *tree) >+{ >+ struct smb2_handle fh; >+ NTSTATUS status; >+ TALLOC_CTX *tmp_ctx = talloc_new(tree); >+ bool ok; >+ uint16_t compression_fmt; >+ >+ ok = test_setup_create_fill(torture, tree, tmp_ctx, >+ FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL, >+ FILE_ATTRIBUTE_NORMAL); >+ torture_assert(torture, ok, "setup compression file"); >+ >+ /* skip if the server DOES support compression */ >+ status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh, >+ &ok); >+ torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS"); >+ if (ok) { >+ smb2_util_close(tree, fh); >+ torture_skip(torture, "FS compression supported\n"); >+ } >+ >+ /* >+ * Despite not supporting compression, we should get a successful >+ * response indicating that the file is uncompressed - like WS2016. >+ */ >+ status = test_ioctl_compress_get(torture, tmp_ctx, tree, fh, >+ &compression_fmt); >+ torture_assert_ntstatus_ok(torture, status, "FSCTL_GET_COMPRESSION"); >+ >+ torture_assert(torture, (compression_fmt == COMPRESSION_FORMAT_NONE), >+ "initial compression state not NONE"); >+ >+ smb2_util_close(tree, fh); >+ talloc_free(tmp_ctx); >+ return true; >+} >+ >+static bool test_ioctl_compress_notsup_set(struct torture_context *torture, >+ struct smb2_tree *tree) >+{ >+ struct smb2_handle fh; >+ NTSTATUS status; >+ TALLOC_CTX *tmp_ctx = talloc_new(tree); >+ bool ok; >+ >+ ok = test_setup_create_fill(torture, tree, tmp_ctx, >+ FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL, >+ FILE_ATTRIBUTE_NORMAL); >+ torture_assert(torture, ok, "setup compression file"); >+ >+ /* skip if the server DOES support compression */ >+ status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh, >+ &ok); >+ torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS"); >+ if (ok) { >+ smb2_util_close(tree, fh); >+ torture_skip(torture, "FS compression supported\n"); >+ } >+ >+ status = test_ioctl_compress_set(torture, tmp_ctx, tree, fh, >+ COMPRESSION_FORMAT_DEFAULT); >+ torture_assert_ntstatus_equal(torture, status, >+ NT_STATUS_NOT_SUPPORTED, >+ "FSCTL_GET_COMPRESSION"); >+ >+ smb2_util_close(tree, fh); >+ talloc_free(tmp_ctx); >+ return true; >+} >+ > /* > basic testing of the SMB2 FSCTL_QUERY_NETWORK_INTERFACE_INFO ioctl > */ >@@ -6169,6 +6241,10 @@ struct torture_suite *torture_smb2_ioctl_init(void) > test_ioctl_compress_set_file_attr); > torture_suite_add_1smb2_test(suite, "compress_perms", > test_ioctl_compress_perms); >+ torture_suite_add_1smb2_test(suite, "compress_notsup_get", >+ test_ioctl_compress_notsup_get); >+ torture_suite_add_1smb2_test(suite, "compress_notsup_set", >+ test_ioctl_compress_notsup_set); > torture_suite_add_1smb2_test(suite, "network_interface_info", > test_ioctl_network_interface_info); > torture_suite_add_1smb2_test(suite, "sparse_file_flag", >-- >2.6.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jra
:
review+
Actions:
View
Attachments on
bug 12144
:
12539
|
12548
|
12549
|
12805
|
12806
|
13583
|
13615