s3:smb2_lock: return RANGE_NOT_LOCKED instead of CANCELLED for logoff and tdis
authorStefan Metzmacher <metze@samba.org>
Mon, 10 Mar 2014 08:47:11 +0000 (09:47 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 1 Apr 2014 07:05:08 +0000 (09:05 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4d1d288b89d259f1b69eb3ed643b86d39e03f6bf)

source3/smbd/smb2_lock.c

index 56c594bb822d2a78e072f1a8027f029ae0e4798c..2ee7afa5d69ef29dea4adbeb27b2576a7479d8f8 100644 (file)
@@ -383,6 +383,26 @@ static bool smbd_smb2_lock_cancel(struct tevent_req *req)
 
        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;
 }