[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu Aug 15 17:52:04 MDT 2013
The branch, master has been updated
via 0a42493 libctdb: Avoid an explicit memset
via e0bda35 torture: support Windows 2k8 response for compress_invalid_buf
via 2c7c3fd torture: add more [no-]compress-on-open ioctl tests
via 337a94f torture: add file_attribs arg to file create helper
via 0ad2ca9 torture: add compressed file attribute ioctl test
via e1b4586 torture: check for filesystem compression capability
via f47ff9d torture: extend FSCTL_[GET/SET]_COMPRESSION tests
from b706ca6 s3:libsmb: call smb2cli_logoff() from cli_ulogoff()
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0a42493763509880e0aa34fc59c78875e6f9af08
Author: Volker Lendecke <vl at samba.org>
Date: Tue Aug 13 10:50:15 2013 +0000
libctdb: Avoid an explicit memset
Give the compiler a chance to use better code. Saves a few bytes of text.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Aug 16 01:51:55 CEST 2013 on sn-devel-104
commit e0bda35cf5f3b4d0da9a1c1a6b84a49390d4e3e2
Author: David Disseldorp <ddiss at samba.org>
Date: Tue Aug 13 18:07:28 2013 +0200
torture: support Windows 2k8 response for compress_invalid_buf
Windows Server 2012 returns NT_STATUS_INVALID_USER_BUFFER, Windows
Server 2008r2 returns NT_STATUS_INVALID_PARAMETER. Don't fail the test
if either status is returned.
Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2c7c3fd2d68ca8ce82f46c32d6c97b02131af524
Author: David Disseldorp <ddiss at samba.org>
Date: Tue Aug 13 18:07:27 2013 +0200
torture: add more [no-]compress-on-open ioctl tests
compress_create_with_attr: Specifies the FILE_ATTRIBUTE_COMPRESSED
attribute at create time, then checks the created file.
compress_inherit_disable: Creates under a compressed directory, a file
with the NTCREATEX_OPTIONS_NO_COMPRESSION option. Then checks that the
newly created file doesn't inherit the parent compression state.
Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 337a94f7568fb3f5e02dbee0e10659de99258c8e
Author: David Disseldorp <ddiss at samba.org>
Date: Tue Aug 13 18:07:26 2013 +0200
torture: add file_attribs arg to file create helper
Allows for the testing of file creation with FILE_ATTRIBUTE_COMPRESSED.
Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0ad2ca98ce3fd19872637098d9accba6191ec0ee
Author: David Disseldorp <ddiss at samba.org>
Date: Tue Aug 13 18:07:25 2013 +0200
torture: add compressed file attribute ioctl test
After marking a file for compression via FSCTL_SET_COMPRESSION, the
FILE_ATTRIBUTE_COMPRESSED flag should be present. Test for this.
Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e1b45869de5b7b36b263cb034b9682401b726422
Author: David Disseldorp <ddiss at samba.org>
Date: Tue Aug 13 18:07:24 2013 +0200
torture: check for filesystem compression capability
Only run the compression tests if the compression capability is returned
by the server in response to an SMB2_QUERY_INFO(FS attribute info)
request.
Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f47ff9d2271990d43a1387ff39c0e75d01611b2a
Author: David Disseldorp <ddiss at samba.org>
Date: Tue Aug 13 18:07:23 2013 +0200
torture: extend FSCTL_[GET/SET]_COMPRESSION tests
Check for inheritance of compression attributes from parent directories.
Also, test error handling for invalid requests.
Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/lib/ctdbd_conn.c | 3 +-
source4/torture/smb2/ioctl.c | 511 ++++++++++++++++++++++++++++++++++++++----
2 files changed, 473 insertions(+), 41 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 1481a9c..4f5dce0 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -201,7 +201,7 @@ static NTSTATUS ctdbd_connect(TALLOC_CTX *mem_ctx,
{
struct ctdb_packet_context *result;
const char *sockname = lp_ctdbd_socket();
- struct sockaddr_un addr;
+ struct sockaddr_un addr = { 0, };
int fd;
socklen_t salen;
@@ -211,7 +211,6 @@ static NTSTATUS ctdbd_connect(TALLOC_CTX *mem_ctx,
return map_nt_error_from_unix(errno);
}
- ZERO_STRUCT(addr);
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", sockname);
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
index 6b5895b..75379af 100644
--- a/source4/torture/smb2/ioctl.c
+++ b/source4/torture/smb2/ioctl.c
@@ -3,7 +3,7 @@
test suite for SMB2 ioctl operations
- Copyright (C) David Disseldorp 2011
+ Copyright (C) David Disseldorp 2011-2013
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@
#define FNAME "testfsctl.dat"
#define FNAME2 "testfsctl2.dat"
+#define DNAME "testfsctl_dir"
/*
basic testing of SMB2 shadow copy calls
@@ -153,7 +154,8 @@ static bool test_setup_create_fill(struct torture_context *torture,
const char *fname,
struct smb2_handle *fh,
uint64_t size,
- uint32_t desired_access)
+ uint32_t desired_access,
+ uint32_t file_attributes)
{
struct smb2_create io;
NTSTATUS status;
@@ -165,7 +167,7 @@ static bool test_setup_create_fill(struct torture_context *torture,
ZERO_STRUCT(io);
io.in.desired_access = desired_access;
- io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ io.in.file_attributes = file_attributes;
io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io.in.share_access =
NTCREATEX_SHARE_ACCESS_DELETE|
@@ -214,11 +216,13 @@ static bool test_setup_copy_chunk(struct torture_context *torture,
enum ndr_err_code ndr_ret;
ok = test_setup_create_fill(torture, tree, mem_ctx, FNAME,
- src_h, src_size, src_desired_access);
+ src_h, src_size, src_desired_access,
+ FILE_ATTRIBUTE_NORMAL);
torture_assert(torture, ok, "src file create fill");
ok = test_setup_create_fill(torture, tree, mem_ctx, FNAME2,
- dest_h, dest_size, dest_desired_access);
+ dest_h, dest_size, dest_desired_access,
+ FILE_ATTRIBUTE_NORMAL);
torture_assert(torture, ok, "dest file create fill");
ZERO_STRUCTPN(ioctl);
@@ -1530,20 +1534,41 @@ static bool test_ioctl_copy_chunk_max_output_sz(struct torture_context *torture,
return true;
}
-static bool test_ioctl_compress_file_flag(struct torture_context *torture,
- struct smb2_tree *tree)
+static NTSTATUS test_ioctl_compress_fs_supported(struct torture_context *torture,
+ struct smb2_tree *tree,
+ TALLOC_CTX *mem_ctx,
+ struct smb2_handle *fh,
+ bool *compress_support)
{
- struct smb2_handle fh;
NTSTATUS status;
+ union smb_fsinfo info;
+
+ ZERO_STRUCT(info);
+ info.generic.level = RAW_QFS_ATTRIBUTE_INFORMATION;
+ info.generic.handle = *fh;
+ status = smb2_getinfo_fs(tree, tree, &info);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (info.attribute_info.out.fs_attr & FILE_FILE_COMPRESSION) {
+ *compress_support = true;
+ } else {
+ *compress_support = false;
+ }
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS test_ioctl_compress_get(struct torture_context *torture,
+ TALLOC_CTX *mem_ctx,
+ struct smb2_tree *tree,
+ struct smb2_handle fh,
+ uint16_t *_compression_fmt)
+{
union smb_ioctl ioctl;
- TALLOC_CTX *tmp_ctx = talloc_new(tree);
struct compression_state cmpr_state;
enum ndr_err_code ndr_ret;
- bool ok;
-
- ok = test_setup_create_fill(torture, tree, tmp_ctx,
- FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL);
- torture_assert(torture, ok, "setup compression file");
+ NTSTATUS status;
ZERO_STRUCT(ioctl);
ioctl.smb2.level = RAW_IOCTL_SMB2;
@@ -1552,66 +1577,462 @@ static bool test_ioctl_compress_file_flag(struct torture_context *torture,
ioctl.smb2.in.max_response_size = sizeof(struct compression_state);
ioctl.smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
- status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
- if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)
- || NT_STATUS_EQUAL(status, NT_STATUS_INVALID_DEVICE_REQUEST)) {
- smb2_util_close(tree, fh);
- torture_skip(torture, "FSCTL_GET_COMPRESSION not supported\n");
+ status = smb2_ioctl(tree, mem_ctx, &ioctl.smb2);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
- torture_assert_ntstatus_ok(torture, status, "FSCTL_GET_COMPRESSION");
- ndr_ret = ndr_pull_struct_blob(&ioctl.smb2.out.out, tmp_ctx,
+ ndr_ret = ndr_pull_struct_blob(&ioctl.smb2.out.out, mem_ctx,
&cmpr_state,
(ndr_pull_flags_fn_t)ndr_pull_compression_state);
- torture_assert_ndr_success(torture, ndr_ret,
- "ndr_pull_compression_state");
+ if (ndr_ret != NDR_ERR_SUCCESS) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
- torture_assert(torture, (cmpr_state.format == COMPRESSION_FORMAT_NONE),
- "initial compression state not NONE");
+ *_compression_fmt = cmpr_state.format;
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS test_ioctl_compress_set(struct torture_context *torture,
+ TALLOC_CTX *mem_ctx,
+ struct smb2_tree *tree,
+ struct smb2_handle fh,
+ uint16_t compression_fmt)
+{
+ union smb_ioctl ioctl;
+ struct compression_state cmpr_state;
+ enum ndr_err_code ndr_ret;
+ NTSTATUS status;
ZERO_STRUCT(ioctl);
ioctl.smb2.level = RAW_IOCTL_SMB2;
ioctl.smb2.in.file.handle = fh;
ioctl.smb2.in.function = FSCTL_SET_COMPRESSION;
+ ioctl.smb2.in.max_response_size = 0;
ioctl.smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
- cmpr_state.format = COMPRESSION_FORMAT_DEFAULT;
- ndr_ret = ndr_push_struct_blob(&ioctl.smb2.in.out, tmp_ctx,
+ cmpr_state.format = compression_fmt;
+ ndr_ret = ndr_push_struct_blob(&ioctl.smb2.in.out, mem_ctx,
&cmpr_state,
(ndr_push_flags_fn_t)ndr_push_compression_state);
- torture_assert_ndr_success(torture, ndr_ret,
- "ndr_push_compression_state");
+ if (ndr_ret != NDR_ERR_SUCCESS) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
- status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
+ status = smb2_ioctl(tree, mem_ctx, &ioctl.smb2);
+ return status;
+}
+
+static bool test_ioctl_compress_file_flag(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");
+
+ 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 not supported\n");
+ }
+
+ 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");
+
+ status = test_ioctl_compress_set(torture, tmp_ctx, tree, fh,
+ COMPRESSION_FORMAT_DEFAULT);
+ torture_assert_ntstatus_ok(torture, status, "FSCTL_SET_COMPRESSION");
+
+ 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_LZNT1),
+ "invalid compression state after set");
+
+ smb2_util_close(tree, fh);
+ talloc_free(tmp_ctx);
+ return true;
+}
+
+static bool test_ioctl_compress_dir_inherit(struct torture_context *torture,
+ struct smb2_tree *tree)
+{
+ struct smb2_handle dirh;
+ struct smb2_handle fh;
+ NTSTATUS status;
+ TALLOC_CTX *tmp_ctx = talloc_new(tree);
+ uint16_t compression_fmt;
+ bool ok;
+ char path_buf[PATH_MAX];
+
+ smb2_deltree(tree, DNAME);
+ status = smb2_util_mkdir(tree, DNAME);
+ torture_assert_ntstatus_ok(torture, status, "mkdir");
+
+ ok = test_setup_create_fill(torture, tree, tmp_ctx,
+ DNAME, &dirh, 0, SEC_RIGHTS_FILE_ALL,
+ FILE_ATTRIBUTE_DIRECTORY);
+ torture_assert(torture, ok, "setup compression directory");
+
+ status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &dirh,
+ &ok);
+ torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS");
+ if (!ok) {
+ smb2_util_close(tree, dirh);
+ smb2_deltree(tree, DNAME);
+ torture_skip(torture, "FS compression not supported\n");
+ }
+
+ /* set compression on parent dir, then check for inheritance */
+ status = test_ioctl_compress_set(torture, tmp_ctx, tree, dirh,
+ COMPRESSION_FORMAT_LZNT1);
+ torture_assert_ntstatus_ok(torture, status, "FSCTL_SET_COMPRESSION");
+
+ status = test_ioctl_compress_get(torture, tmp_ctx, tree, dirh,
+ &compression_fmt);
+ torture_assert_ntstatus_ok(torture, status, "FSCTL_GET_COMPRESSION");
+
+ torture_assert(torture, (compression_fmt == COMPRESSION_FORMAT_LZNT1),
+ "invalid compression state after set");
+
+ snprintf(path_buf, PATH_MAX, "%s\\%s", DNAME, FNAME);
+ ok = test_setup_create_fill(torture, tree, tmp_ctx,
+ path_buf, &fh, 4096, SEC_RIGHTS_FILE_ALL,
+ FILE_ATTRIBUTE_NORMAL);
+ torture_assert(torture, ok, "setup compression file");
+
+ 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_LZNT1),
+ "compression attr not inherited by new file");
+
+ /* check compressed data is consistent */
+ ok = check_pattern(torture, tree, tmp_ctx, fh, 0, 4096, 0);
+
+ /* disable dir compression attr, file should remain compressed */
+ status = test_ioctl_compress_set(torture, tmp_ctx, tree, dirh,
+ COMPRESSION_FORMAT_NONE);
torture_assert_ntstatus_ok(torture, status, "FSCTL_SET_COMPRESSION");
+ 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_LZNT1),
+ "file compression attr removed after dir change");
+ smb2_util_close(tree, fh);
+
+ /* new files should no longer inherit compression attr */
+ snprintf(path_buf, PATH_MAX, "%s\\%s", DNAME, FNAME2);
+ ok = test_setup_create_fill(torture, tree, tmp_ctx,
+ path_buf, &fh, 0, SEC_RIGHTS_FILE_ALL,
+ FILE_ATTRIBUTE_NORMAL);
+ torture_assert(torture, ok, "setup file");
+
+ 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),
+ "compression attr present on new file");
+
+ smb2_util_close(tree, fh);
+ smb2_util_close(tree, dirh);
+ smb2_deltree(tree, DNAME);
+ talloc_free(tmp_ctx);
+ return true;
+}
+
+static bool test_ioctl_compress_invalid_format(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");
+
+ 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 not supported\n");
+ }
+
+ status = test_ioctl_compress_set(torture, tmp_ctx, tree, fh,
+ 0x0042); /* bogus */
+ torture_assert_ntstatus_equal(torture, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "invalid FSCTL_SET_COMPRESSION");
+
+ 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_invalid_buf(struct torture_context *torture,
+ struct smb2_tree *tree)
+{
+ struct smb2_handle fh;
+ NTSTATUS status;
+ TALLOC_CTX *tmp_ctx = talloc_new(tree);
+ bool ok;
+ union smb_ioctl ioctl;
+
+ 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");
+
+ 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 not supported\n");
+ }
+
ZERO_STRUCT(ioctl);
ioctl.smb2.level = RAW_IOCTL_SMB2;
ioctl.smb2.in.file.handle = fh;
ioctl.smb2.in.function = FSCTL_GET_COMPRESSION;
- ioctl.smb2.in.max_response_size = sizeof(struct compression_state);
+ ioctl.smb2.in.max_response_size = 0; /* no room for rsp data */
ioctl.smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
- torture_assert_ntstatus_ok(torture, status,
- "FSCTL_GET_COMPRESSION");
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_USER_BUFFER)
+ && !NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
+ /* neither Server 2k12 nor 2k8r2 response status */
+ torture_assert(torture, true,
+ "invalid FSCTL_SET_COMPRESSION");
+ }
- ndr_ret = ndr_pull_struct_blob(&ioctl.smb2.out.out, tmp_ctx,
- &cmpr_state,
- (ndr_pull_flags_fn_t)ndr_pull_compression_state);
+ smb2_util_close(tree, fh);
+ talloc_free(tmp_ctx);
+ return true;
+}
- torture_assert_ndr_success(torture, ndr_ret,
- "ndr_pull_compression_state");
+static bool test_ioctl_compress_query_file_attr(struct torture_context *torture,
+ struct smb2_tree *tree)
+{
+ struct smb2_handle fh;
+ union smb_fileinfo io;
+ 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");
+
+ 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 not supported\n");
+ }
+
+ status = smb2_getinfo_file(tree, tmp_ctx, &io);
+ ZERO_STRUCT(io);
+ io.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
+ io.generic.in.file.handle = fh;
+ status = smb2_getinfo_file(tree, tmp_ctx, &io);
+ torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FILE");
+
+ torture_assert(torture,
+ ((io.all_info2.out.attrib & FILE_ATTRIBUTE_COMPRESSED) == 0),
+ "compression attr before set");
+
+ status = test_ioctl_compress_set(torture, tmp_ctx, tree, fh,
+ COMPRESSION_FORMAT_DEFAULT);
+ torture_assert_ntstatus_ok(torture, status, "FSCTL_SET_COMPRESSION");
+
+ ZERO_STRUCT(io);
+ io.generic.level = RAW_FILEINFO_BASIC_INFORMATION;
+ io.generic.in.file.handle = fh;
+ status = smb2_getinfo_file(tree, tmp_ctx, &io);
+ torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FILE");
+
+ torture_assert(torture,
+ (io.basic_info.out.attrib & FILE_ATTRIBUTE_COMPRESSED),
+ "no compression attr after set");
+
+ smb2_util_close(tree, fh);
+ talloc_free(tmp_ctx);
+ return true;
+}
+
+/*
+ * Specify FILE_ATTRIBUTE_COMPRESSED on creation, Windows does not retain this
+ * attribute.
+ */
+static bool test_ioctl_compress_create_with_attr(struct torture_context *torture,
+ struct smb2_tree *tree)
+{
+ struct smb2_handle fh2;
+ union smb_fileinfo io;
+ NTSTATUS status;
+ TALLOC_CTX *tmp_ctx = talloc_new(tree);
+ uint16_t compression_fmt;
+ bool ok;
+
+ ok = test_setup_create_fill(torture, tree, tmp_ctx,
+ FNAME2, &fh2, 0, SEC_RIGHTS_FILE_ALL,
+ (FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_COMPRESSED));
+ torture_assert(torture, ok, "setup compression file");
+
+ status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh2,
+ &ok);
+ torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS");
+ if (!ok) {
+ smb2_util_close(tree, fh2);
+ torture_skip(torture, "FS compression not supported\n");
+ }
+
--
Samba Shared Repository
More information about the samba-cvs
mailing list