]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix more SMB2-OPLOCK bugs. Only 3 more issues to address then we're good to go on...
authorJeremy Allison <jra@samba.org>
Tue, 11 May 2010 21:00:38 +0000 (14:00 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 11 May 2010 21:00:38 +0000 (14:00 -0700)
Jeremy.

source3/smbd/smb2_create.c
source3/smbd/trans2.c

index eb8b2c527b11c80195a6ee12c876310c9c19872a..25e995c3bd1c389858e966d36c47f8a2549bbdfa 100644 (file)
@@ -52,7 +52,12 @@ static uint8_t map_samba_oplock_levels_to_smb2(int oplock_type)
                return SMB2_OPLOCK_LEVEL_BATCH;
        } else if (EXCLUSIVE_OPLOCK_TYPE(oplock_type)) {
                return SMB2_OPLOCK_LEVEL_EXCLUSIVE;
-       } else if (LEVEL_II_OPLOCK_TYPE(oplock_type)) {
+       } else if (oplock_type == LEVEL_II_OPLOCK) {
+               /*
+                * Don't use LEVEL_II_OPLOCK_TYPE here as
+                * this also includes FAKE_LEVEL_II_OPLOCKs
+                * which are internal only.
+                */
                return SMB2_OPLOCK_LEVEL_II;
        } else {
                return SMB2_OPLOCK_LEVEL_NONE;
index 25ca3fd3aee8c696ff299d37ea410d3dec433bc5..5d51a7fb90267766ed3f54b06a0f279df0b6b589 100644 (file)
@@ -5951,7 +5951,15 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
                return status;
        }
 
-       if (fsp && fsp->base_fsp) {
+       /* Ok, this looks wrong to me, but appears to
+        * be how SMB2 renames work. CHECK WITH Microsoft !
+        * jra.
+        */
+       if (fsp->oplock_type != NO_OPLOCK) {
+               return NT_STATUS_SHARING_VIOLATION;
+       }
+
+       if (fsp->base_fsp) {
                /* newname must be a stream name. */
                if (newname[0] != ':') {
                        return NT_STATUS_NOT_SUPPORTED;