summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-09-21 21:43:36 +0200
committerKarolin Seeger <kseeger@samba.org>2012-09-28 09:23:07 +0200
commitc4d803bcc7baf6282fdb81a147e310ad8713e8f1 (patch)
tree138eb5fe8e8276cbbf1bd16d76b398f86ce650c6
parent021dd55db013b552859afaf3f5a59fb2edb9f805 (diff)
downloadsamba-c4d803bcc7baf6282fdb81a147e310ad8713e8f1.tar.gz
s3:smbd:smb2: simplify smbd_smb2_request_validate() and smbd_smb2_request_dispatch()
removes unnneccary checks/assignments for compound_related and next_status and duplicate setting of error status. And remove (now) unused next_status from struct smbd_smb2_request. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> (cherry picked from commit 1ae6f9c62629f8513bbe93a56775b3c64ff06832) Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--source3/smbd/globals.h2
-rw-r--r--source3/smbd/smb2_server.c52
2 files changed, 3 insertions, 51 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 566f04d71f3..c86d7bf1d44 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -485,8 +485,6 @@ struct smbd_smb2_request {
struct smb_request *smb1req;
struct files_struct *compat_chain_fsp;
- NTSTATUS next_status;
-
/*
* The sub request for async backend calls.
* This is used for SMB2 Cancel.
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 8443ed775a8..77f25a9a821 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -713,7 +713,6 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req)
struct iovec *hdr = SMBD_SMB2_IDX_HDR_IOV(req,in,idx);
struct iovec *body = SMBD_SMB2_IDX_BODY_IOV(req,in,idx);
const uint8_t *inhdr = NULL;
- uint32_t flags;
if (hdr->iov_len != SMB2_HDR_BODY) {
return NT_STATUS_INVALID_PARAMETER;
@@ -733,50 +732,6 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req)
if (!smb2_validate_message_id(req->sconn, inhdr)) {
return NT_STATUS_INVALID_PARAMETER;
}
-
- flags = IVAL(inhdr, SMB2_HDR_FLAGS);
- if (idx < SMBD_SMB2_NUM_IOV_PER_REQ) {
- /*
- * the 1st request should never have the
- * SMB2_HDR_FLAG_CHAINED flag set
- */
- if (flags & SMB2_HDR_FLAG_CHAINED) {
- req->next_status = NT_STATUS_INVALID_PARAMETER;
- return NT_STATUS_OK;
- }
- } else if (idx < 2*SMBD_SMB2_NUM_IOV_PER_REQ) {
- /*
- * the 2nd request triggers related vs. unrelated
- * compounded requests
- */
- if (flags & SMB2_HDR_FLAG_CHAINED) {
- req->compound_related = true;
- }
- } else {
-#if 0
- /*
- * It seems the this tests are wrong
- * see the SMB2-COMPOUND test
- */
-
- /*
- * all other requests should match the 2nd one
- */
- if (flags & SMB2_HDR_FLAG_CHAINED) {
- if (!req->compound_related) {
- req->next_status =
- NT_STATUS_INVALID_PARAMETER;
- return NT_STATUS_OK;
- }
- } else {
- if (req->compound_related) {
- req->next_status =
- NT_STATUS_INVALID_PARAMETER;
- return NT_STATUS_OK;
- }
- }
-#endif
- }
}
return NT_STATUS_OK;
@@ -2003,9 +1958,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
* This check is mostly for giving the correct error code
* for compounded requests.
*/
- if (!NT_STATUS_IS_OK(req->next_status)) {
- return smbd_smb2_request_error(req, req->next_status);
- }
if (!NT_STATUS_IS_OK(session_status)) {
return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
}
@@ -2061,7 +2013,8 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
return smbd_smb2_request_error(req, NT_STATUS_ACCESS_DENIED);
}
- if (req->compound_related) {
+ if (flags & SMB2_HDR_FLAG_CHAINED) {
+ req->compound_related = true;
req->sconn->smb2.compound_related_in_progress = true;
}
@@ -2425,6 +2378,7 @@ static NTSTATUS smbd_smb2_request_reply(struct smbd_smb2_request *req)
}
if (req->compound_related) {
+ req->compound_related = false;
req->sconn->smb2.compound_related_in_progress = false;
}