The branch, master has been updated
       via  bc5a75a ntvfs: Skip the new smb2.oplock.batch26 test
       via  6a795c0 Adding new oplock test 'batch26'.
       via  c6e726f s3: smbd: streams - Ensure share mode validation ignores 
internal opens (op_mid == 0).
      from  d744eb0 ctdb-doc: Add reference to new magepage ctdb-statistics

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


- Log -----------------------------------------------------------------
commit bc5a75a83c0a1b3dd9e6a0fd3e1f19fe403dd68c
Author: Volker Lendecke <[email protected]>
Date:   Fri Sep 12 10:11:43 2014 +0000

    ntvfs: Skip the new smb2.oplock.batch26 test
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Fri Sep 12 14:39:00 CEST 2014 on sn-devel-104

commit 6a795c0a84d8257e988eeed73da8ae4dcf6695bf
Author: Hemanth Thummala <[email protected]>
Date:   Thu Sep 11 14:15:56 2014 -0700

    Adding new oplock test 'batch26'.
    
    Signed-off-by: Hemanth Thummala <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit c6e726f719e8c510fc51e681532183803f766ca0
Author: Volker Lendecke <[email protected]>
Date:   Tue Sep 9 10:53:52 2014 +0000

    s3: smbd: streams - Ensure share mode validation ignores internal opens 
(op_mid == 0).
    
    Fixes bug 10797 - smbd panic at find_oplock_types
    
    https://bugzilla.samba.org/show_bug.cgi?id=10797
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 selftest/knownfail            |    1 +
 source3/smbd/open.c           |    7 +++-
 source4/torture/smb2/oplock.c |   81 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index 880b600..0b789c9 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -168,6 +168,7 @@
 ^samba4.smb2.oplock.batch9\(.*\)$ # samba 4 oplocks are a mess
 ^samba4.smb2.oplock.batch10\(.*\)$ # samba 4 oplocks are a mess
 ^samba4.smb2.oplock.batch20\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch26\(.*\)$
 ^samba4.smb2.oplock.stream1 # samba 4 oplocks are a mess
 ^samba4.smb2.getinfo.complex # streams on directories does not work
 ^samba4.smb2.getinfo.qfs_buffercheck # S4 does not do the 
INFO_LENGTH_MISMATCH/BUFFER_OVERFLOW thingy
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index f077210..7626b58 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1110,7 +1110,7 @@ static void validate_my_share_entries(struct 
smbd_server_connection *sconn,
                return;
        }
 
-       if (share_entry->share_file_id == 0) {
+       if (share_entry->op_mid == 0) {
                /* INTERNAL_OPEN_ONLY */
                return;
        }
@@ -1291,6 +1291,11 @@ static bool validate_oplock_types(struct share_mode_lock 
*lck)
                        continue;
                }
 
+               if (e->op_mid == 0) {
+                       /* INTERNAL_OPEN_ONLY */
+                       continue;
+               }
+
                if (e->op_type == NO_OPLOCK && is_stat_open(e->access_mask)) {
                        /* We ignore stat opens in the table - they
                           always have NO_OPLOCK and never get or
diff --git a/source4/torture/smb2/oplock.c b/source4/torture/smb2/oplock.c
index 463b431..d2a2832 100644
--- a/source4/torture/smb2/oplock.c
+++ b/source4/torture/smb2/oplock.c
@@ -2801,6 +2801,86 @@ static bool test_smb2_oplock_batch25(struct 
torture_context *tctx,
        return ret;
 }
 
+static bool test_smb2_oplock_batch26(struct torture_context *tctx,
+                                        struct smb2_tree *tree1)
+{
+
+        NTSTATUS status;
+        bool ret = true;
+        union smb_open io;
+        struct smb2_handle h, h1, h2, h3;
+        const char *fname_base = BASEDIR "\\test_oplock.txt";
+        const char *stream = "Stream One:$DATA";
+        const char *fname_stream;
+
+        status = torture_smb2_testdir(tree1, BASEDIR, &h);
+        torture_assert_ntstatus_ok(tctx, status, "Error creating directory");
+
+        tree1->session->transport->oplock.handler = torture_oplock_handler;
+        tree1->session->transport->oplock.private_data = tree1;
+
+        fname_stream = talloc_asprintf(tctx, "%s:%s", fname_base, stream);
+
+        /*
+          base ntcreatex parms
+        */
+        ZERO_STRUCT(io.smb2);
+        io.generic.level = RAW_OPEN_SMB2;
+        io.smb2.in.desired_access = 0x120089;
+        io.smb2.in.alloc_size = 0;
+        io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+        io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ | 
NTCREATEX_SHARE_ACCESS_DELETE |
+                                  NTCREATEX_SHARE_ACCESS_WRITE;
+        io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
+        io.smb2.in.create_options = 0;
+        io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
+        io.smb2.in.security_flags = 0;
+        io.smb2.in.fname = fname_base;
+
+        /*
+          Open base file with a batch oplock.
+        */
+        torture_comment(tctx, "Open the base file with batch oplock\n");
+        io.smb2.in.create_flags = NTCREATEX_FLAGS_EXTENDED;
+        io.smb2.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
+
+        status = smb2_create(tree1, tctx, &(io.smb2));
+        torture_assert_ntstatus_ok(tctx, status, "Error opening base file");
+        h1 = io.smb2.out.file.handle;
+        CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
+
+        torture_comment(tctx, "Got batch oplock on base file\n");
+
+        torture_comment(tctx, "Opening stream file with batch oplock..\n");
+
+        io.smb2.in.fname = fname_stream;
+
+        status = smb2_create(tree1, tctx, &(io.smb2));
+        torture_assert_ntstatus_ok(tctx, status, "Error opening stream file");
+        h2 = io.smb2.out.file.handle;
+        CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
+
+        torture_comment(tctx, "Got batch oplock on stream file\n");
+
+        torture_comment(tctx, "Open base file again with batch oplock\n");
+
+        io.smb2.in.fname = fname_base;
+
+        status = smb2_create(tree1, tctx, &(io.smb2));
+        torture_assert_ntstatus_ok(tctx, status, "Error opening the file");
+        h3 = io.smb2.out.file.handle;
+        CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_II);
+
+        smb2_util_close(tree1, h1);
+        smb2_util_close(tree1, h2);
+        smb2_util_close(tree1, h3);
+        smb2_util_close(tree1, h);
+done:
+        smb2_deltree(tree1, BASEDIR);
+        return ret;
+
+}
+
 /* Test how oplocks work on streams. */
 static bool test_raw_oplock_stream1(struct torture_context *tctx,
                                    struct smb2_tree *tree1,
@@ -3770,6 +3850,7 @@ struct torture_suite *torture_smb2_oplocks_init(void)
        torture_suite_add_2smb2_test(suite, "batch23", 
test_smb2_oplock_batch23);
        torture_suite_add_2smb2_test(suite, "batch24", 
test_smb2_oplock_batch24);
        torture_suite_add_1smb2_test(suite, "batch25", 
test_smb2_oplock_batch25);
+       torture_suite_add_1smb2_test(suite, "batch26", 
test_smb2_oplock_batch26);
        torture_suite_add_2smb2_test(suite, "stream1", test_raw_oplock_stream1);
        torture_suite_add_2smb2_test(suite, "doc", test_smb2_oplock_doc);
        torture_suite_add_2smb2_test(suite, "brl1", test_smb2_oplock_brl1);


-- 
Samba Shared Repository

Reply via email to