]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd:smb2: simplify smbd_smb2_request_validate() and smbd_smb2_request_dispatch()
authorMichael Adam <obnox@samba.org>
Fri, 21 Sep 2012 19:43:36 +0000 (21:43 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 28 Sep 2012 07:12:46 +0000 (09:12 +0200)
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>
(similar to commit 1ae6f9c62629f8513bbe93a56775b3c64ff06832)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/globals.h
source3/smbd/smb2_server.c

index eefc2c61d82a21daf811beda31aff4c3b5a6f1e3..f515f1965e989ca9607d01bdcbbd8e1a89f646d3 100644 (file)
@@ -369,8 +369,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.
index 4736f983a70cfea57b6b564dd702d28bab0bc64d..a595f8063821b4e086ecb4272bb648afec096758 100644 (file)
@@ -426,7 +426,6 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req)
 
        for (idx=1; idx < count; idx += 3) {
                const uint8_t *inhdr = NULL;
-               uint32_t flags;
 
                if (req->in.vector[idx].iov_len != SMB2_HDR_BODY) {
                        return NT_STATUS_INVALID_PARAMETER;
@@ -446,50 +445,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 == 1) {
-                       /*
-                        * 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 == 4) {
-                       /*
-                        * the 2nd request triggers related vs. unrelated
-                        * compounded requests
-                        */
-                       if (flags & SMB2_HDR_FLAG_CHAINED) {
-                               req->compound_related = true;
-                       }
-               } else if (idx > 4) {
-#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;
@@ -1374,9 +1329,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);
                }
@@ -1402,7 +1354,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;
        }
 
@@ -1853,6 +1806,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;
        }