it seems that lock flags are only validated when UNLOCK is set
authorAndrew Tridgell <tridge@samba.org>
Tue, 27 May 2008 06:02:10 +0000 (16:02 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 27 May 2008 06:02:10 +0000 (16:02 +1000)
(This used to be commit d1bde5830cd56042236d72598e5cfe9c7abc4c47)

source4/ntvfs/ntvfs_generic.c

index c5b88da3d1e87a668c43a0fc3c0879e1707dea8f..e449e61b34fa9e76f54bde0949000bef7fbf0a0e 100644 (file)
@@ -1044,11 +1044,12 @@ NTSTATUS ntvfs_map_lock(struct ntvfs_module_context *ntvfs,
                        return NT_STATUS_NO_MEMORY;
                }
                for (i=0;i<lck->smb2.in.lock_count;i++) {
-                       if (lck->smb2.in.locks[i].flags & ~SMB2_LOCK_FLAG_ALL_MASK) {
-                               return NT_STATUS_INVALID_PARAMETER;
-                       }
                        if (lck->smb2.in.locks[i].flags & SMB2_LOCK_FLAG_UNLOCK) {
                                int j = lck2->generic.in.ulock_cnt;
+                               if (lck->smb2.in.locks[i].flags & 
+                                   (SMB2_LOCK_FLAG_SHARED|SMB2_LOCK_FLAG_EXCLUSIVE)) {
+                                       return NT_STATUS_INVALID_PARAMETER;
+                               }
                                lck2->generic.in.ulock_cnt++;
                                lck2->generic.in.locks[j].pid = 0;
                                lck2->generic.in.locks[j].offset = lck->smb2.in.locks[i].offset;