summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2013-11-18 14:54:28 +0100
committerJeremy Allison <jra@samba.org>2013-11-22 08:56:45 -0800
commit7dd05f55a8cc34a345fd87e868e3d391e06229b3 (patch)
tree88571092d580a1ab5f6808c57545680f38801ba0 /source4
parent452c2ac704b2b1e17f5d82910703eec0411eece2 (diff)
downloadsamba-7dd05f55a8cc34a345fd87e868e3d391e06229b3.tar.gz
samba-7dd05f55a8cc34a345fd87e868e3d391e06229b3.tar.xz
samba-7dd05f55a8cc34a345fd87e868e3d391e06229b3.zip
torture: test dir non-inherit in compress_inherit_disable
Also add a note reguarding Windows 2008GM copy-chunk note: Windows 2008GM (non-R2) fails the copy-chunk src=dest overlap test, as it appears to use a different chunk copy algorithm to 208R2. Takeaway advice is to avoid using copy-chunk when the source and destination ranges overlap in the same file. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/smb2/ioctl.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
index fa9e190d19..56667b132c 100644
--- a/source4/torture/smb2/ioctl.c
+++ b/source4/torture/smb2/ioctl.c
@@ -173,6 +173,9 @@ static bool test_setup_create_fill(struct torture_context *torture,
NTCREATEX_SHARE_ACCESS_DELETE|
NTCREATEX_SHARE_ACCESS_READ|
NTCREATEX_SHARE_ACCESS_WRITE;
+ if (file_attributes & FILE_ATTRIBUTE_DIRECTORY) {
+ io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ }
io.in.fname = fname;
status = smb2_create(tree, mem_ctx, &io);
@@ -1059,7 +1062,8 @@ static bool test_ioctl_copy_chunk_src_is_dest(struct torture_context *torture,
* default (vfs_cc_state.buf).
*
* This test uses an 8-byte overlap at 2040-2048, so that it passes against
- * Windows 2008, 2012 and Samba servers.
+ * Windows 2008r2, 2012 and Samba servers. Note, 2008GM fails, as it appears
+ * to use a different copy algorithm to 2008r2.
*/
static bool
test_ioctl_copy_chunk_src_is_dest_overlap(struct torture_context *torture,
@@ -1728,9 +1732,6 @@ static bool test_ioctl_compress_dir_inherit(struct torture_context *torture,
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);
@@ -2005,7 +2006,6 @@ static bool test_ioctl_compress_inherit_disable(struct torture_context *torture,
struct smb2_create io;
smb2_deltree(tree, DNAME);
- smb2_util_mkdir(tree, DNAME);
ok = test_setup_create_fill(torture, tree, tmp_ctx,
DNAME, &dirh, 0, SEC_RIGHTS_FILE_ALL,
FILE_ATTRIBUTE_DIRECTORY);
@@ -2034,7 +2034,6 @@ static bool test_ioctl_compress_inherit_disable(struct torture_context *torture,
smb2_util_close(tree, dirh);
snprintf(path_buf, PATH_MAX, "%s\\%s", DNAME, FNAME);
- torture_comment(torture, "path is: %s\n", path_buf);
ok = test_setup_create_fill(torture, tree, tmp_ctx,
path_buf, &fh, 0, SEC_RIGHTS_FILE_ALL,
FILE_ATTRIBUTE_NORMAL);
@@ -2054,7 +2053,7 @@ static bool test_ioctl_compress_inherit_disable(struct torture_context *torture,
ZERO_STRUCT(io);
io.in.desired_access = SEC_RIGHTS_FILE_ALL;
io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
- io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
+ io.in.create_disposition = NTCREATEX_DISP_CREATE;
io.in.create_options = NTCREATEX_OPTIONS_NO_COMPRESSION;
io.in.share_access =
NTCREATEX_SHARE_ACCESS_DELETE|
@@ -2073,8 +2072,36 @@ static bool test_ioctl_compress_inherit_disable(struct torture_context *torture,
torture_assert(torture, (compression_fmt == COMPRESSION_FORMAT_NONE),
"compression attr inherited by NO_COMPRESSION file");
-
smb2_util_close(tree, fh);
+
+
+ snprintf(path_buf, PATH_MAX, "%s\\%s", DNAME, DNAME);
+ ZERO_STRUCT(io);
+ io.in.desired_access = SEC_RIGHTS_FILE_ALL;
+ io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
+ io.in.create_disposition = NTCREATEX_DISP_CREATE;
+ io.in.create_options = (NTCREATEX_OPTIONS_NO_COMPRESSION
+ | NTCREATEX_OPTIONS_DIRECTORY);
+ io.in.share_access =
+ NTCREATEX_SHARE_ACCESS_DELETE|
+ NTCREATEX_SHARE_ACCESS_READ|
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ io.in.fname = path_buf;
+
+ status = smb2_create(tree, tmp_ctx, &io);
+ torture_assert_ntstatus_ok(torture, status, "dir create");
+
+ dirh = io.out.file.handle;
+
+ 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_NONE),
+ "compression attr inherited by NO_COMPRESSION dir");
+ smb2_util_close(tree, dirh);
+ smb2_deltree(tree, DNAME);
+
talloc_free(tmp_ctx);
return true;
}