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)
committerJeremy Allison <jra@samba.org>
Wed, 12 Mar 2014 16:27:37 +0000 (09:27 -0700)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_lock.c

index 69bc09a3339abdf86ea1e4d7f9e1f10fc5618232..5da14e9c2dda899d7fe57e97762773ae2e4f3eb7 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;
 }