diff options
author | David Disseldorp <ddiss@samba.org> | 2013-11-18 14:54:38 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-11-22 08:56:45 -0800 |
commit | aa197c18c4dbd7fbe45702e59600e7acad013f63 (patch) | |
tree | 1be9863f3f6c2a780ca628a215d5dd60b9b5939a /source4/torture | |
parent | 9a3d4d484e0868d9174f37a8dfd9efd4e77c044d (diff) | |
download | samba-aa197c18c4dbd7fbe45702e59600e7acad013f63.tar.gz samba-aa197c18c4dbd7fbe45702e59600e7acad013f63.tar.xz samba-aa197c18c4dbd7fbe45702e59600e7acad013f63.zip |
torture: split open from test_setup_create_fill
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/smb2/ioctl.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c index d401c216f7..946cd6b722 100644 --- a/source4/torture/smb2/ioctl.c +++ b/source4/torture/smb2/ioctl.c @@ -149,21 +149,15 @@ static bool check_pattern(struct torture_context *torture, return true; } -static bool test_setup_create_fill(struct torture_context *torture, - struct smb2_tree *tree, TALLOC_CTX *mem_ctx, - const char *fname, - struct smb2_handle *fh, - uint64_t size, - uint32_t desired_access, - uint32_t file_attributes) +static bool test_setup_open(struct torture_context *torture, + struct smb2_tree *tree, TALLOC_CTX *mem_ctx, + const char *fname, + struct smb2_handle *fh, + uint32_t desired_access, + uint32_t file_attributes) { struct smb2_create io; NTSTATUS status; - uint64_t i; - uint8_t *buf = talloc_zero_size(mem_ctx, size); - torture_assert(torture, (buf != NULL), "no memory for file data buf"); - - smb2_util_unlink(tree, fname); ZERO_STRUCT(io); io.in.desired_access = desired_access; @@ -183,6 +177,32 @@ static bool test_setup_create_fill(struct torture_context *torture, *fh = io.out.file.handle; + return true; +} + +static bool test_setup_create_fill(struct torture_context *torture, + struct smb2_tree *tree, TALLOC_CTX *mem_ctx, + const char *fname, + struct smb2_handle *fh, + uint64_t size, + uint32_t desired_access, + uint32_t file_attributes) +{ + NTSTATUS status; + bool ok; + uint64_t i; + uint8_t *buf = talloc_zero_size(mem_ctx, size); + torture_assert(torture, (buf != NULL), "no memory for file data buf"); + + smb2_util_unlink(tree, fname); + + ok = test_setup_open(torture, tree, mem_ctx, + fname, + fh, + desired_access, + file_attributes); + torture_assert(torture, ok, "file open"); + if (size > 0) { uint64_t cur_off = 0; for (i = 0; i <= size - 8; i += 8) { |