From: Volker Lendecke Date: Tue, 23 Sep 2014 16:49:46 +0000 (+0200) Subject: s3:smb2_break: First test for NT_STATUS_INVALID_OPLOCK_PROTOCOL, then for in_oplock_l... X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=2d44498740d98edd9d09f12d35dc91d8d17e0c62;p=obnox%2Fsamba%2Fsamba-obnox.git s3:smb2_break: First test for NT_STATUS_INVALID_OPLOCK_PROTOCOL, then for in_oplock_level being reasonable Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Reviewed-by: Stefan Metzmacher Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Nov 12 00:03:34 CET 2014 on sn-devel-104 --- diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c index 5c079ecdc7c..449245645d9 100644 --- a/source3/smbd/smb2_break.c +++ b/source3/smbd/smb2_break.c @@ -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);