From 848e7c5830a869d86d7fe236acc1e6a1949252d3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 27 May 2008 16:02:10 +1000 Subject: it seems that lock flags are only validated when UNLOCK is set (This used to be commit d1bde5830cd56042236d72598e5cfe9c7abc4c47) --- source4/ntvfs/ntvfs_generic.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index c5b88da3d1..e449e61b34 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -1044,11 +1044,12 @@ NTSTATUS ntvfs_map_lock(struct ntvfs_module_context *ntvfs, return NT_STATUS_NO_MEMORY; } for (i=0;ismb2.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; -- cgit