1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

smbd: Move read_packet_remainder to smb2_process.c

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
David Mulder 2022-03-17 15:29:18 -06:00 committed by Jeremy Allison
parent e287f7c27b
commit cd111f7269
3 changed files with 22 additions and 20 deletions

View File

@ -310,26 +310,6 @@ static bool valid_packet_size(size_t len)
return true;
}
static NTSTATUS read_packet_remainder(int fd, char *buffer,
unsigned int timeout, ssize_t len)
{
NTSTATUS status;
if (len <= 0) {
return NT_STATUS_OK;
}
status = read_fd_with_timeout(fd, buffer, len, len, timeout, NULL);
if (!NT_STATUS_IS_OK(status)) {
char addr[INET6_ADDRSTRLEN];
DEBUG(0, ("read_fd_with_timeout failed for client %s read "
"error = %s.\n",
get_peer_addr(fd, addr, sizeof(addr)),
nt_errstr(status)));
}
return status;
}
/****************************************************************************
Attempt a zerocopy writeX read. We know here that len > smb_size-4
****************************************************************************/

View File

@ -900,6 +900,8 @@ size_t srv_set_message(char *buf,
size_t num_words,
size_t num_bytes,
bool zero);
NTSTATUS read_packet_remainder(int fd, char *buffer,
unsigned int timeout, ssize_t len);
/* The following definitions come from smbd/quotas.c */

View File

@ -125,3 +125,23 @@ size_t srv_set_message(char *buf,
smb_setlen(buf,(smb_size + num_words*2 + num_bytes - 4));
return (smb_size + num_words*2 + num_bytes);
}
NTSTATUS read_packet_remainder(int fd, char *buffer,
unsigned int timeout, ssize_t len)
{
NTSTATUS status;
if (len <= 0) {
return NT_STATUS_OK;
}
status = read_fd_with_timeout(fd, buffer, len, len, timeout, NULL);
if (!NT_STATUS_IS_OK(status)) {
char addr[INET6_ADDRSTRLEN];
DEBUG(0, ("read_fd_with_timeout failed for client %s read "
"error = %s.\n",
get_peer_addr(fd, addr, sizeof(addr)),
nt_errstr(status)));
}
return status;
}