]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Move check for SMB2 compound request to new function
authorChristof Schmitt <cs@samba.org>
Fri, 22 Sep 2017 00:41:25 +0000 (17:41 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 14 Nov 2017 11:39:13 +0000 (12:39 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13047

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit cfa2c3083080016a1288474b8879039db4dbf6b1)

source3/smbd/globals.h
source3/smbd/smb2_read.c
source3/smbd/smb2_server.c

index 67d3a892d58e98069c76ee9d0486e45ccd96e196..d3b9800f590b185e57536dc8a37f341d1ea0da58 100644 (file)
@@ -224,6 +224,7 @@ void smbd_server_connection_terminate_ex(struct smbXsrv_connection *xconn,
 
 const char *smb2_opcode_name(uint16_t opcode);
 bool smbd_is_smb2_header(const uint8_t *inbuf, size_t size);
+bool smbd_smb2_is_compound(const struct smbd_smb2_request *req);
 
 NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd,
                             struct smbXsrv_connection **_xconn);
index 89527f387485485d318f183499dab462d56fc50f..c28aaae4ecf68a981aa90ca3f83641fd628e40a2 100644 (file)
@@ -345,7 +345,7 @@ static NTSTATUS schedule_smb2_sendfile_read(struct smbd_smb2_request *smb2req,
        if (!lp__use_sendfile(SNUM(fsp->conn)) ||
            smb2req->do_signing ||
            smb2req->do_encryption ||
-           smb2req->in.vector_count >= (2*SMBD_SMB2_NUM_IOV_PER_REQ) ||
+           smbd_smb2_is_compound(smb2req) ||
            (fsp->base_fsp != NULL) ||
            (fsp->wcp != NULL) ||
            (!S_ISREG(fsp->fsp_name->st.st_ex_mode)) ||
index acaa0126dd8ad118ddc85f024fb93cf223df1b41..e6bc7536938d32452d02e8370c8c0feeebcb3311 100644 (file)
@@ -204,6 +204,11 @@ bool smbd_is_smb2_header(const uint8_t *inbuf, size_t size)
        return true;
 }
 
+bool smbd_smb2_is_compound(const struct smbd_smb2_request *req)
+{
+       return req->in.vector_count >= (2*SMBD_SMB2_NUM_IOV_PER_REQ);
+}
+
 static NTSTATUS smbd_initialize_smb2(struct smbXsrv_connection *xconn,
                                     uint64_t expected_seq_low)
 {