From e287f7c27bd13bec73bd301643ec80e8f8957ae7 Mon Sep 17 00:00:00 2001 From: David Mulder Date: Thu, 17 Mar 2022 15:23:33 -0600 Subject: [PATCH] smbd: Move srv_set_message to smb2_process.c Signed-off-by: David Mulder Reviewed-by: Jeremy Allison --- source3/smbd/process.c | 18 ------------------ source3/smbd/proto.h | 8 ++++---- source3/smbd/smb2_process.c | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 93afe531856..c6001b7eca9 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -281,24 +281,6 @@ out: return (ret > 0); } -/******************************************************************* - Setup the word count and byte count for a smb message. -********************************************************************/ - -size_t srv_set_message(char *buf, - size_t num_words, - size_t num_bytes, - bool zero) -{ - if (zero && (num_words || num_bytes)) { - memset(buf + smb_size,'\0',num_words*2 + num_bytes); - } - SCVAL(buf,smb_wct,num_words); - SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); - smb_setlen(buf,(smb_size + num_words*2 + num_bytes - 4)); - return (smb_size + num_words*2 + num_bytes); -} - static bool valid_smb_header(const uint8_t *inbuf) { if (is_encrypted_packet(inbuf)) { diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index cc4efe52672..2181c1fcd98 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -852,10 +852,6 @@ bool smb1_srv_send(struct smbXsrv_connection *xconn, char *buffer, bool do_signing, uint32_t seqnum, bool do_encrypt, struct smb_perfcount_data *pcd); -size_t srv_set_message(char *buf, - size_t num_words, - size_t num_bytes, - bool zero); void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn, uint64_t mid); bool schedule_deferred_open_message_smb(struct smbXsrv_connection *xconn, @@ -900,6 +896,10 @@ bool srv_send_smb(struct smbXsrv_connection *xconn, char *buffer, bool no_signing, uint32_t seqnum, bool do_encrypt, struct smb_perfcount_data *pcd); +size_t srv_set_message(char *buf, + size_t num_words, + size_t num_bytes, + bool zero); /* The following definitions come from smbd/quotas.c */ diff --git a/source3/smbd/smb2_process.c b/source3/smbd/smb2_process.c index 030b6145903..0207c60267d 100644 --- a/source3/smbd/smb2_process.c +++ b/source3/smbd/smb2_process.c @@ -107,3 +107,21 @@ bool srv_send_smb(struct smbXsrv_connection *xconn, char *buffer, do_encrypt, pcd); #endif } + +/******************************************************************* + Setup the word count and byte count for a smb message. +********************************************************************/ + +size_t srv_set_message(char *buf, + size_t num_words, + size_t num_bytes, + bool zero) +{ + if (zero && (num_words || num_bytes)) { + memset(buf + smb_size,'\0',num_words*2 + num_bytes); + } + SCVAL(buf,smb_wct,num_words); + SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); + smb_setlen(buf,(smb_size + num_words*2 + num_bytes - 4)); + return (smb_size + num_words*2 + num_bytes); +}