The branch, master has been updated
       via  54ae7ca selftest/knownfail: samba3.smb2.durable-v2-open.reopen{1,2} 
fails currently
       via  640752b s4:torture/smb2: add smb2.durable-v2-open.reopen{1,2} tests
       via  1874ebe s4:torture/smb2: check that the server should ignore the 
fname in a DHnC request
       via  afaea04 s4:torture/smb2: don't expect a DHnQ response in a DHnC 
request
      from  8ba8020 s4 dns: Make debug output less noisy

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 54ae7ca417628ddae5be275891f3782f245d7c5f
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Sep 6 12:18:05 2012 +0200

    selftest/knownfail: samba3.smb2.durable-v2-open.reopen{1,2} fails currently
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <me...@samba.org>
    Autobuild-Date(master): Fri Sep  7 02:12:22 CEST 2012 on sn-devel-104

commit 640752b969714bd43e328a05804affad63aa6d98
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Sep 6 11:51:12 2012 +0200

    s4:torture/smb2: add smb2.durable-v2-open.reopen{1,2} tests
    
    They show that only the content of the DH2C request matches and
    all other values in the SMB2 Create request are ignored.
    
    metze

commit 1874ebeb37ea1604823d8cedb76344b292453d74
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Sep 6 12:38:54 2012 +0200

    s4:torture/smb2: check that the server should ignore the fname in a DHnC 
request
    
    metze

commit afaea04f1cb5a31ba0bfd0f5c8ad37c1bdc6d79e
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Sep 6 11:49:42 2012 +0200

    s4:torture/smb2: don't expect a DHnQ response in a DHnC request
    
    This is fixed in Windows 2012 and matches the [MS-SMB2] documentation
    now.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 selftest/knownfail                     |    2 +
 source4/torture/smb2/durable_open.c    |    7 +-
 source4/torture/smb2/durable_v2_open.c |  184 ++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index 4e6eb43..30c66b8 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -189,6 +189,8 @@
 ^samba3.smb2.durable-open.oplock
 ^samba3.smb2.durable-v2-open.open-oplock
 ^samba3.smb2.durable-v2-open.open-lease
+^samba3.smb2.durable-v2-open.reopen1
+^samba3.smb2.durable-v2-open.reopen2
 ^samba3.smb2.durable-v2-open.persistent-open-oplock
 ^samba3.smb2.durable-v2-open.persistent-open-lease
 ^samba3.smb2.ioctl.shadow_copy
diff --git a/source4/torture/smb2/durable_open.c 
b/source4/torture/smb2/durable_open.c
index 659fa9d..8524fd6 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -443,14 +443,14 @@ bool test_durable_open_reopen2(struct torture_context 
*tctx,
        }
 
        ZERO_STRUCT(io2);
-       io2.in.fname = fname;
+       /* the path name is ignored by the server */
+       io2.in.fname = "__non_existing_fname__";
        io2.in.durable_handle = h;
        h = NULL;
 
        status = smb2_create(tree, mem_ctx, &io2);
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
-       CHECK_VAL(io2.out.durable_open, true);
        CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
        _h = io2.out.file.handle;
        h = &_h;
@@ -524,7 +524,6 @@ bool test_durable_open_reopen2a(struct torture_context 
*tctx,
        status = smb2_create(tree, mem_ctx, &io2);
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
-       CHECK_VAL(io2.out.durable_open, true);
        CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
        _h = io2.out.file.handle;
        h = &_h;
@@ -689,7 +688,6 @@ bool test_durable_open_reopen4(struct torture_context *tctx,
        _h = io2.out.file.handle;
        h = &_h;
        CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
-       CHECK_VAL(io2.out.durable_open, true);
        CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
 
 done:
@@ -895,7 +893,6 @@ bool test_durable_open_file_position(struct torture_context 
*tctx,
 
        status = smb2_create(tree2, mem_ctx, &io2);
        CHECK_STATUS(status, NT_STATUS_OK);
-       CHECK_VAL(io2.out.durable_open, true);
        CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
        CHECK_VAL(io2.out.reserved, 0x00);
        CHECK_VAL(io2.out.create_action, NTCREATEX_ACTION_EXISTED);
diff --git a/source4/torture/smb2/durable_v2_open.c 
b/source4/torture/smb2/durable_v2_open.c
index 700179e..3b5f7b6 100644
--- a/source4/torture/smb2/durable_v2_open.c
+++ b/source4/torture/smb2/durable_v2_open.c
@@ -369,6 +369,188 @@ bool test_durable_v2_open_lease(struct torture_context 
*tctx,
        return ret;
 }
 
+/**
+ * basic test for doing a durable open
+ * and do a durable reopen on the same connection
+ * while the first open is still active (fails)
+ */
+bool test_durable_v2_open_reopen1(struct torture_context *tctx,
+                                 struct smb2_tree *tree)
+{
+       NTSTATUS status;
+       TALLOC_CTX *mem_ctx = talloc_new(tctx);
+       char fname[256];
+       struct smb2_handle _h;
+       struct smb2_handle *h = NULL;
+       struct smb2_create io1, io2;
+       bool ret = true;
+
+       /* Choose a random name in case the state is left a little funky. */
+       snprintf(fname, 256, "durable_v2_open_reopen1_%s.dat",
+                generate_random_str(tctx, 8));
+
+       smb2_util_unlink(tree, fname);
+
+       smb2_oplock_create_share(&io1, 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;
+
+       status = smb2_create(tree, mem_ctx, &io1);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       _h = io1.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);
+
+       /* try a durable reconnect while the file is still open */
+       ZERO_STRUCT(io2);
+       io2.in = io1.in;
+       io2.in.durable_open_v2 = false;
+       io2.in.durable_handle_v2 = h;
+       io2.in.create_guid = io1.in.create_guid;
+       status = smb2_create(tree, mem_ctx, &io2);
+       CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
+done:
+       if (h != NULL) {
+               smb2_util_close(tree, *h);
+       }
+
+       smb2_util_unlink(tree, fname);
+
+       talloc_free(tree);
+
+       talloc_free(mem_ctx);
+
+       return ret;
+}
+
+/**
+ * basic test for doing a durable open
+ * tcp disconnect, reconnect, do a durable reopen (succeeds)
+ */
+bool test_durable_v2_open_reopen2(struct torture_context *tctx,
+                                 struct smb2_tree *tree)
+{
+       NTSTATUS status;
+       TALLOC_CTX *mem_ctx = talloc_new(tctx);
+       char fname[256];
+       struct smb2_handle _h;
+       struct smb2_handle *h = NULL;
+       struct smb2_create io1, io2;
+       bool ret = true;
+
+       /* Choose a random name in case the state is left a little funky. */
+       snprintf(fname, 256, "durable_v2_open_reopen2_%s.dat",
+                generate_random_str(tctx, 8));
+
+       smb2_util_unlink(tree, fname);
+
+       smb2_oplock_create_share(&io1, 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;
+
+       status = smb2_create(tree, mem_ctx, &io1);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       _h = io1.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);
+
+       /* disconnect, reconnect and then do durable reopen */
+       talloc_free(tree);
+       tree = NULL;
+
+       if (!torture_smb2_connection(tctx, &tree)) {
+               torture_warning(tctx, "couldn't reconnect, bailing\n");
+               ret = false;
+               goto done;
+       }
+
+       ZERO_STRUCT(io2);
+       io2.in.fname = "";
+       io2.in.durable_handle_v2 = h;
+       status = smb2_create(tree, mem_ctx, &io2);
+       CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
+       ZERO_STRUCT(io2);
+       io2.in.fname = "__non_existing_fname__";
+       io2.in.durable_handle_v2 = h;
+       status = smb2_create(tree, mem_ctx, &io2);
+       CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
+       ZERO_STRUCT(io2);
+       io2.in.fname = fname;
+       io2.in.durable_handle_v2 = h;
+       status = smb2_create(tree, mem_ctx, &io2);
+       CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
+       ZERO_STRUCT(io2);
+       /*
+        * These are completely ignored by the server
+        */
+       io2.in.security_flags = 0x78;
+       io2.in.oplock_level = 0x78;
+       io2.in.impersonation_level = 0x12345678;
+       io2.in.create_flags = 0x12345678;
+       io2.in.reserved = 0x12345678;
+       io2.in.desired_access = 0x12345678;
+       io2.in.file_attributes = 0x12345678;
+       io2.in.share_access = 0x12345678;
+       io2.in.create_disposition = 0x12345678;
+       io2.in.create_options = 0x12345678;
+       io2.in.fname = "__non_existing_fname__";
+
+       /*
+        * only io2.in.durable_handle_v2 and
+        * io2.in.create_guid are checked
+        */
+       io2.in.durable_open_v2 = false;
+       io2.in.durable_handle_v2 = h;
+       io2.in.create_guid = io1.in.create_guid;
+       h = NULL;
+
+       status = smb2_create(tree, mem_ctx, &io2);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
+       CHECK_VAL(io1.out.durable_open, false);
+       CHECK_VAL(io1.out.durable_open_v2, true);
+       CHECK_VAL(io1.out.persistent_open, false);
+       CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
+       _h = io2.out.file.handle;
+       h = &_h;
+
+done:
+       if (h != NULL) {
+               smb2_util_close(tree, *h);
+       }
+
+       smb2_util_unlink(tree, fname);
+
+       talloc_free(tree);
+
+       talloc_free(mem_ctx);
+
+       return ret;
+}
 
 /**
  * basic persistent open test.
@@ -546,6 +728,8 @@ struct torture_suite 
*torture_smb2_durable_v2_open_init(void)
 
        torture_suite_add_1smb2_test(suite, "open-oplock", 
test_durable_v2_open_oplock);
        torture_suite_add_1smb2_test(suite, "open-lease", 
test_durable_v2_open_lease);
+       torture_suite_add_1smb2_test(suite, "reopen1", 
test_durable_v2_open_reopen1);
+       torture_suite_add_1smb2_test(suite, "reopen2", 
test_durable_v2_open_reopen2);
        torture_suite_add_1smb2_test(suite, "persistent-open-oplock", 
test_persistent_open_oplock);
        torture_suite_add_1smb2_test(suite, "persistent-open-lease", 
test_persistent_open_lease);
 


-- 
Samba Shared Repository

Reply via email to