]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smb2_server: remove state->hdr.done and always set state->vector first
authorStefan Metzmacher <metze@samba.org>
Thu, 15 Apr 2021 08:23:37 +0000 (10:23 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 6 Sep 2023 19:30:35 +0000 (19:30 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/globals.h
source3/smbd/smb2_server.c

index d071dc4c23b4dcbabf82c32d59040c06d4e83fe1..db79d548035514921285c98fab942bff609f025a 100644 (file)
@@ -460,7 +460,6 @@ struct smbXsrv_connection {
                        struct smbd_smb2_request *req;
                        struct {
                                uint8_t nbt[NBT_HDR_SIZE];
-                               bool done;
                        } hdr;
                        struct iovec vector;
                        struct msghdr msg;
index b0a475ec8c1cb0d75f4c2891f128ac5b35ff2577..9a3cc8447bad18586a8fbf433e45078ff65fc986 100644 (file)
@@ -4589,6 +4589,10 @@ static NTSTATUS smbd_smb2_request_next_incoming(struct smbXsrv_connection *xconn
        *state = (struct smbd_smb2_request_read_state) {
                .req = req,
                .min_recv_size = lp_min_receive_file_size(),
+               .vector = (struct iovec) {
+                       .iov_base = (void *)state->hdr.nbt,
+                       .iov_len = NBT_HDR_SIZE,
+               },
        };
 
        TEVENT_FD_READABLE(xconn->transport.fde);
@@ -4915,12 +4919,6 @@ static NTSTATUS smbd_smb2_io_handler(struct smbXsrv_connection *xconn,
        }
 
 again:
-       if (!state->hdr.done) {
-               state->hdr.done = true;
-
-               state->vector.iov_base = (void *)state->hdr.nbt;
-               state->vector.iov_len = NBT_HDR_SIZE;
-       }
 
        state->msg = (struct msghdr) {
                .msg_iov = &state->vector,
@@ -5053,6 +5051,10 @@ got_full:
                *state = (struct smbd_smb2_request_read_state) {
                        .req = req,
                        .min_recv_size = lp_min_receive_file_size(),
+                       .vector = (struct iovec) {
+                               .iov_base = (void *)state->hdr.nbt,
+                               .iov_len = NBT_HDR_SIZE,
+                       },
                };
                req = NULL;
                goto again;