diff options
Diffstat (limited to 'source3/smbd/smb2_lock.c')
-rw-r--r-- | source3/smbd/smb2_lock.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index 671cd6f066..2ee7afa5d6 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -368,23 +368,43 @@ static NTSTATUS smbd_smb2_lock_recv(struct tevent_req *req) static bool smbd_smb2_lock_cancel(struct tevent_req *req) { - struct smbd_smb2_request *smb2req = NULL; - struct smbd_smb2_lock_state *state = tevent_req_data(req, - struct smbd_smb2_lock_state); - if (!state) { - return false; - } + struct smbd_smb2_request *smb2req = NULL; + struct smbd_smb2_lock_state *state = tevent_req_data(req, + struct smbd_smb2_lock_state); + if (!state) { + return false; + } - if (!state->smb2req) { - return false; - } + if (!state->smb2req) { + return false; + } - smb2req = state->smb2req; + smb2req = state->smb2req; remove_pending_lock(state, state->blr); tevent_req_defer_callback(req, smb2req->sconn->ev_ctx); + + /* + * If the request is canceled because of logoff, tdis or close + * the status is NT_STATUS_RANGE_NOT_LOCKED instead of + * NT_STATUS_CANCELLED. + * + * Note that the close case is handled in + * cancel_pending_lock_requests_by_fid_smb2(SHUTDOWN_CLOSE) + * for now. + */ + if (!NT_STATUS_IS_OK(smb2req->session->status)) { + tevent_req_nterror(req, NT_STATUS_RANGE_NOT_LOCKED); + return true; + } + + if (!NT_STATUS_IS_OK(smb2req->tcon->status)) { + tevent_req_nterror(req, NT_STATUS_RANGE_NOT_LOCKED); + return true; + } + tevent_req_nterror(req, NT_STATUS_CANCELLED); - return true; + return true; } /**************************************************************** |