summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-09-26 05:12:02 +0200
committerStefan Metzmacher <metze@samba.org>2013-10-05 14:04:08 +0200
commit6fc56616404e55cf6bd60b0fbfd190ddcccb0b0f (patch)
treefb1b3804a60966d7cbd25f88ca86e934d3737ac3 /source4/torture
parent1bd2ab41611fc66386d8d7d0e4c7d4f948177eab (diff)
downloadsamba-6fc56616404e55cf6bd60b0fbfd190ddcccb0b0f.tar.gz
samba-6fc56616404e55cf6bd60b0fbfd190ddcccb0b0f.tar.bz2
samba-6fc56616404e55cf6bd60b0fbfd190ddcccb0b0f.zip
s4:torture:smb2: extend the durable-v2-open.reopen2 test
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/smb2/durable_v2_open.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/source4/torture/smb2/durable_v2_open.c b/source4/torture/smb2/durable_v2_open.c
index 1d8533966f..9a33f87f31 100644
--- a/source4/torture/smb2/durable_v2_open.c
+++ b/source4/torture/smb2/durable_v2_open.c
@@ -479,6 +479,7 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
struct smb2_handle *h = NULL;
struct smb2_create io;
struct GUID create_guid = GUID_random();
+ struct GUID create_guid_invalid = GUID_random();
bool ret = true;
/* Choose a random name in case the state is left a little funky. */
@@ -507,9 +508,8 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
CHECK_VAL(io.out.persistent_open, false);
CHECK_VAL(io.out.timeout, io.in.timeout);
- /* disconnect, reconnect and then do durable reopen */
- talloc_free(tree);
- tree = NULL;
+ /* disconnect, leaving the durable open */
+ TALLOC_FREE(tree);
if (!torture_smb2_connection(tctx, &tree)) {
torture_warning(tctx, "couldn't reconnect, bailing\n");
@@ -517,6 +517,10 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
goto done;
}
+ /*
+ * first a few failure cases
+ */
+
ZERO_STRUCT(io);
io.in.fname = "";
io.in.durable_handle_v2 = h;
@@ -535,10 +539,46 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
status = smb2_create(tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ /* a non-zero but non-matching create_guid does not change it: */
ZERO_STRUCT(io);
+ io.in.fname = fname;
+ io.in.durable_handle_v2 = h;
+ io.in.create_guid = create_guid_invalid;
+ status = smb2_create(tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
/*
- * These are completely ignored by the server
+ * now success:
+ * The important difference is that the create_guid is provided.
*/
+ ZERO_STRUCT(io);
+ io.in.fname = fname;
+ io.in.durable_open_v2 = false;
+ io.in.durable_handle_v2 = h;
+ io.in.create_guid = create_guid;
+ h = NULL;
+
+ status = smb2_create(tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io.out.durable_open, false);
+ CHECK_VAL(io.out.durable_open_v2, false); /* no dh2q response blob */
+ CHECK_VAL(io.out.persistent_open, false);
+ CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
+ _h = io.out.file.handle;
+ h = &_h;
+
+ /* disconnect one more time */
+ TALLOC_FREE(tree);
+
+ if (!torture_smb2_connection(tctx, &tree)) {
+ torture_warning(tctx, "couldn't reconnect, bailing\n");
+ ret = false;
+ goto done;
+ }
+
+ ZERO_STRUCT(io);
+ /* These are completely ignored by the server */
io.in.security_flags = 0x78;
io.in.oplock_level = 0x78;
io.in.impersonation_level = 0x12345678;