s3:smb2_break: First test for NT_STATUS_INVALID_OPLOCK_PROTOCOL, then for in_oplock_l...
authorVolker Lendecke <vl@samba.org>
Tue, 23 Sep 2014 16:49:46 +0000 (18:49 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 11 Nov 2014 23:03:34 +0000 (00:03 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Nov 12 00:03:34 CET 2014 on sn-devel-104

source3/smbd/smb2_break.c

index 5c079ecdc7c993fe8c87a66f7b2ec9298d7908b7..449245645d9a0cc0fc25a4181cb25f749af94ecb 100644 (file)
@@ -52,11 +52,6 @@ NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req)
 
        in_oplock_level         = CVAL(inbody, 0x02);
 
-       if (in_oplock_level != SMB2_OPLOCK_LEVEL_NONE &&
-                       in_oplock_level != SMB2_OPLOCK_LEVEL_II) {
-               return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
-       }
-
        /* 0x03 1 bytes reserved */
        /* 0x04 4 bytes reserved */
        in_file_id_persistent           = BVAL(inbody, 0x08);
@@ -67,6 +62,17 @@ NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
+       /* Are we awaiting a break message ? */
+       if (in_fsp->oplock_timeout == NULL) {
+               return smbd_smb2_request_error(
+                       req, NT_STATUS_INVALID_OPLOCK_PROTOCOL);
+       }
+
+       if (in_oplock_level != SMB2_OPLOCK_LEVEL_NONE &&
+           in_oplock_level != SMB2_OPLOCK_LEVEL_II) {
+               return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
+       }
+
        subreq = smbd_smb2_oplock_break_send(req, req->sconn->ev_ctx,
                                             req, in_fsp, in_oplock_level);
        if (subreq == NULL) {
@@ -177,12 +183,6 @@ static struct tevent_req *smbd_smb2_oplock_break_send(TALLOC_CTX *mem_ctx,
                fsp_str_dbg(fsp),
                fsp_fnum_dbg(fsp)));
 
-       /* Are we awaiting a break message ? */
-       if (fsp->oplock_timeout == NULL) {
-               tevent_req_nterror(req, NT_STATUS_INVALID_OPLOCK_PROTOCOL);
-               return tevent_req_post(req, ev);
-       }
-
        if ((fsp->sent_oplock_break == BREAK_TO_NONE_SENT) ||
                        (break_to_none)) {
                result = remove_oplock(fsp);