s4:torture:smb2: simplify the durable-v2-open.reopen1 test
authorMichael Adam <obnox@samba.org>
Fri, 7 Sep 2012 13:36:33 +0000 (15:36 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 7 Sep 2012 21:39:31 +0000 (23:39 +0200)
only use one smb2_create i/o struct and store the create GUID centrally

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source4/torture/smb2/durable_v2_open.c

index 85620965d1e8edc26c12b96ca12bc9dff6294c24..576fde284ddb5ab4a65a503e1e63aa17145fb845 100644 (file)
@@ -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: