s3:smb2_server: do calculations based on SMBD_SMB2_NUM_IOV_PER_REQ in smbd_smb2_reque...
authorStefan Metzmacher <metze@samba.org>
Wed, 15 Aug 2012 12:43:40 +0000 (14:43 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 15 Aug 2012 12:45:04 +0000 (14:45 +0200)
metze

source3/smbd/smb2_server.c

index a84776afbad61aaafc03d2b73d2bad48cdcf2d53..97739e5bd82a928bd7803933953586996e787f1c 100644 (file)
@@ -648,7 +648,7 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req)
                }
 
                flags = IVAL(inhdr, SMB2_HDR_FLAGS);
-               if (idx == 1) {
+               if (idx < SMBD_SMB2_NUM_IOV_PER_REQ) {
                        /*
                         * the 1st request should never have the
                         * SMB2_HDR_FLAG_CHAINED flag set
@@ -657,7 +657,7 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req)
                                req->next_status = NT_STATUS_INVALID_PARAMETER;
                                return NT_STATUS_OK;
                        }
-               } else if (idx == 4) {
+               } else if (idx < 2*SMBD_SMB2_NUM_IOV_PER_REQ) {
                        /*
                         * the 2nd request triggers related vs. unrelated
                         * compounded requests
@@ -665,7 +665,7 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req)
                        if (flags & SMB2_HDR_FLAG_CHAINED) {
                                req->compound_related = true;
                        }
-               } else if (idx > 4) {
+               } else {
 #if 0
                        /*
                         * It seems the this tests are wrong