From fc0631cae6e8a2cf601c8ae929709ca25d486364 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 7 Sep 2012 15:36:33 +0200 Subject: [PATCH] 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 --- source4/torture/smb2/durable_v2_open.c | 41 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/source4/torture/smb2/durable_v2_open.c b/source4/torture/smb2/durable_v2_open.c index 85620965d1e..576fde284dd 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: -- 2.11.4.GIT