diff options
author | Michael Adam <obnox@samba.org> | 2012-09-21 21:43:36 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2012-09-22 10:18:58 +0200 |
commit | 1ae6f9c62629f8513bbe93a56775b3c64ff06832 (patch) | |
tree | 06c13a1ba858b467a669491dd52d34757813580c /source3 | |
parent | 27d38b5c27bd96d5124c175d946718bf0836b8f4 (diff) | |
download | samba-1ae6f9c62629f8513bbe93a56775b3c64ff06832.tar.gz samba-1ae6f9c62629f8513bbe93a56775b3c64ff06832.tar.bz2 samba-1ae6f9c62629f8513bbe93a56775b3c64ff06832.zip |
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>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/globals.h | 2 | ||||
-rw-r--r-- | source3/smbd/smb2_server.c | 52 |
2 files changed, 3 insertions, 51 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 74e42c77af..9bc6b175b5 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -486,8 +486,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 8443ed775a..77f25a9a82 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; } |