summaryrefslogtreecommitdiff
path: root/source4/torture/smb2
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-09-07 15:36:33 +0200
committerStefan Metzmacher <metze@samba.org>2012-09-07 23:39:31 +0200
commitfc0631cae6e8a2cf601c8ae929709ca25d486364 (patch)
treeba5ec4009d2dfcce7e6a2f5f3e19ed6bab5fe98d /source4/torture/smb2
parent67290e7d2eb8b25b093d38371db046deca781a79 (diff)
downloadsamba-fc0631cae6e8a2cf601c8ae929709ca25d486364.tar.gz
samba-fc0631cae6e8a2cf601c8ae929709ca25d486364.tar.bz2
samba-fc0631cae6e8a2cf601c8ae929709ca25d486364.zip
s4:torture:smb2: simplify the durable-v2-open.reopen1 test
only use one smb2_create i/o struct and store the create GUID centrally Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/torture/smb2')
-rw-r--r--source4/torture/smb2/durable_v2_open.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/source4/torture/smb2/durable_v2_open.c b/source4/torture/smb2/durable_v2_open.c
index 85620965d1..576fde284d 100644
--- a/source4/torture/smb2/durable_v2_open.c
+++ b/source4/torture/smb2/durable_v2_open.c
@@ -382,7 +382,8 @@ bool test_durable_v2_open_reopen1(struct torture_context *tctx,
char fname[256];
struct smb2_handle _h;
struct smb2_handle *h = NULL;
- struct smb2_create io1, io2;
+ struct smb2_create io;
+ struct GUID create_guid = GUID_random();
bool ret = true;
/* Choose a random name in case the state is left a little funky. */
@@ -391,32 +392,32 @@ bool test_durable_v2_open_reopen1(struct torture_context *tctx,
smb2_util_unlink(tree, fname);
- smb2_oplock_create_share(&io1, fname,
+ smb2_oplock_create_share(&io, fname,
smb2_util_share_access(""),
smb2_util_oplock_level("b"));
- io1.in.durable_open = false;
- io1.in.durable_open_v2 = true;
- io1.in.persistent_open = false;
- io1.in.create_guid = GUID_random();
- io1.in.timeout = UINT32_MAX;
+ io.in.durable_open = false;
+ io.in.durable_open_v2 = true;
+ io.in.persistent_open = false;
+ io.in.create_guid = create_guid;
+ io.in.timeout = UINT32_MAX;
- status = smb2_create(tree, mem_ctx, &io1);
+ status = smb2_create(tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- _h = io1.out.file.handle;
+ _h = io.out.file.handle;
h = &_h;
- CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
- CHECK_VAL(io1.out.oplock_level, smb2_util_oplock_level("b"));
- CHECK_VAL(io1.out.durable_open, false);
- CHECK_VAL(io1.out.durable_open_v2, true);
- CHECK_VAL(io1.out.persistent_open, false);
- CHECK_VAL(io1.out.timeout, io1.in.timeout);
+ CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
+ CHECK_VAL(io.out.durable_open, false);
+ CHECK_VAL(io.out.durable_open_v2, true);
+ CHECK_VAL(io.out.persistent_open, false);
+ CHECK_VAL(io.out.timeout, io.in.timeout);
/* try a durable reconnect while the file is still open */
- ZERO_STRUCT(io2);
- io2.in.fname = "";
- io2.in.durable_handle_v2 = h;
- io2.in.create_guid = io1.in.create_guid;
- status = smb2_create(tree, mem_ctx, &io2);
+ ZERO_STRUCT(io);
+ io.in.fname = "";
+ io.in.durable_handle_v2 = h;
+ io.in.create_guid = create_guid;
+ status = smb2_create(tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
done: