From 153323efc55bef47a4694645bb2dbfb3334776a3 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 14 Sep 2021 02:22:09 +0200 Subject: [PATCH] smb2_server: simplify smbd_smb2_advance_incoming() recvfile logic This will make further changes easier... Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- source3/smbd/smb2_server.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 1c15405373b..767cbbb405b 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -4903,7 +4903,14 @@ static NTSTATUS smbd_smb2_advance_incoming(struct smbXsrv_connection *xconn, siz } if (state->pktlen > 0) { - if (state->doing_receivefile && !is_smb2_recvfile_write(state)) { + if (!state->doing_receivefile) { + /* + * we have all the data. + */ + goto got_full; + } + + if (!is_smb2_recvfile_write(state)) { size_t ofs = state->pktlen; /* @@ -4932,8 +4939,8 @@ static NTSTATUS smbd_smb2_advance_incoming(struct smbXsrv_connection *xconn, siz } /* - * Either this is a receivefile write so we've - * done a short read, or if not we have all the data. + * This is a receivefile write so we've + * done a short read. */ goto got_full; } -- 2.47.3