summaryrefslogtreecommitdiff
path: root/source3/smbd/blocking.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2021-11-16 16:15:54 -0800
committerNoel Power <npower@samba.org>2022-01-06 15:11:38 +0000
commitc1d5993489472ac857f83729c901004f26866d6f (patch)
treeb161a7947239afd89612f1baa00c028ca79197b2 /source3/smbd/blocking.c
parent4a567652422f8fcf507fa8e5ec7300d7014268a0 (diff)
downloadsamba-c1d5993489472ac857f83729c901004f26866d6f.tar.gz
s3: smbd: In smbd_smb1_do_locks_send() move access of lock_flav until after we know we have locks in the array.
When we remove the lock_flav parameter this will need to look into the array itself. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org>
Diffstat (limited to 'source3/smbd/blocking.c')
-rw-r--r--source3/smbd/blocking.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index b78768ba609..5c4644566d1 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -271,6 +271,15 @@ struct tevent_req *smbd_smb1_do_locks_send(
state->lock_flav = lock_flav;
state->num_locks = num_locks;
state->locks = locks;
+ state->deny_status = NT_STATUS_LOCK_NOT_GRANTED;
+
+ DBG_DEBUG("state=%p, state->smbreq=%p\n", state, state->smbreq);
+
+ if (num_locks == 0 || locks == NULL) {
+ DBG_DEBUG("no locks\n");
+ tevent_req_done(req);
+ return tevent_req_post(req, ev);
+ }
if (lock_flav == POSIX_LOCK) {
/*
@@ -278,16 +287,6 @@ struct tevent_req *smbd_smb1_do_locks_send(
* NT_STATUS_FILE_LOCK_CONFLICT.
*/
state->deny_status = NT_STATUS_FILE_LOCK_CONFLICT;
- } else {
- state->deny_status = NT_STATUS_LOCK_NOT_GRANTED;
- }
-
- DBG_DEBUG("state=%p, state->smbreq=%p\n", state, state->smbreq);
-
- if (num_locks == 0) {
- DBG_DEBUG("no locks\n");
- tevent_req_done(req);
- return tevent_req_post(req, ev);
}
smbd_smb1_do_locks_try(req);