mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
smbd: Clarify smb2 lock checks
When reading the code it was not immediately clear to me how one of the conditions in [MS-SMB2] 3.3.5.14.2 was satisfied. A separate loop to me is clearer and given that we don't expect thousands of locks in a single call also not significantly less efficient. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
4709373cdf
commit
7d71e8d657
@ -235,6 +235,24 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
|
||||
if (!isunlock && (in_lock_count > 1)) {
|
||||
|
||||
/*
|
||||
* 3.3.5.14.2 says we SHOULD fail with INVALID_PARAMETER if we
|
||||
* have more than one lock and one of those is blocking.
|
||||
*/
|
||||
|
||||
for (i=0; i<in_lock_count; i++) {
|
||||
uint32_t flags = in_locks[i].flags;
|
||||
|
||||
if ((flags & SMB2_LOCK_FLAG_FAIL_IMMEDIATELY) == 0) {
|
||||
tevent_req_nterror(
|
||||
req, NT_STATUS_INVALID_PARAMETER);
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<in_lock_count; i++) {
|
||||
bool invalid = false;
|
||||
|
||||
@ -245,11 +263,6 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
|
||||
invalid = true;
|
||||
break;
|
||||
}
|
||||
if (i > 0) {
|
||||
tevent_req_nterror(req,
|
||||
NT_STATUS_INVALID_PARAMETER);
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
break;
|
||||
|
||||
case SMB2_LOCK_FLAG_SHARED|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY:
|
||||
|
Loading…
x
Reference in New Issue
Block a user