From: David Mulder Date: Fri, 18 Mar 2022 20:15:30 +0000 (-0600) Subject: smbd: Move get_deferred_open_message_state to smb2_process.c X-Git-Tag: tevent-0.12.0~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e3f809953e29927fedd00bec0d17d31194fd855;p=thirdparty%2Fsamba.git smbd: Move get_deferred_open_message_state to smb2_process.c Signed-off-by: David Mulder Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/process.c b/source3/smbd/process.c index afb90e9b95e..e6783404dd8 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -679,52 +679,6 @@ static bool push_queued_message(struct smb_request *req, return True; } -/**************************************************************************** - Return the message queued by this mid. -****************************************************************************/ - -struct pending_message_list *get_deferred_open_message_smb( - struct smbd_server_connection *sconn, uint64_t mid) -{ - struct pending_message_list *pml; - - for (pml = sconn->deferred_open_queue; pml; pml = pml->next) { - if (((uint64_t)SVAL(pml->buf.data,smb_mid)) == mid) { - return pml; - } - } - return NULL; -} - -/**************************************************************************** - Get the state data queued by this mid. -****************************************************************************/ - -bool get_deferred_open_message_state(struct smb_request *smbreq, - struct timeval *p_request_time, - struct deferred_open_record **open_rec) -{ - struct pending_message_list *pml; - - if (smbreq->sconn->using_smb2) { - return get_deferred_open_message_state_smb2(smbreq->smb2req, - p_request_time, - open_rec); - } - - pml = get_deferred_open_message_smb(smbreq->sconn, smbreq->mid); - if (!pml) { - return false; - } - if (p_request_time) { - *p_request_time = pml->request_time; - } - if (open_rec != NULL) { - *open_rec = pml->open_rec; - } - return true; -} - /**************************************************************************** Function to push a deferred open smb message onto a linked list of local smb messages ready for processing. diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 470bc16e105..192be0a3a80 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -852,9 +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); -bool get_deferred_open_message_state(struct smb_request *smbreq, - struct timeval *p_request_time, - struct deferred_open_record **open_rec); bool push_deferred_open_message_smb(struct smb_request *req, struct timeval timeout, struct file_id id, @@ -896,8 +893,6 @@ void process_smb(struct smbXsrv_connection *xconn, uint8_t *inbuf, size_t nread, size_t unread_bytes, uint32_t seqnum, bool encrypted, struct smb_perfcount_data *deferred_pcd); -struct pending_message_list *get_deferred_open_message_smb( - struct smbd_server_connection *sconn, uint64_t mid); /* The following definitions come from smbd/smb2_process.c */ @@ -924,6 +919,9 @@ void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn, bool schedule_deferred_open_message_smb(struct smbXsrv_connection *xconn, uint64_t mid); bool open_was_deferred(struct smbXsrv_connection *xconn, uint64_t mid); +bool get_deferred_open_message_state(struct smb_request *smbreq, + struct timeval *p_request_time, + struct deferred_open_record **open_rec); /* The following definitions come from smbd/quotas.c */ diff --git a/source3/smbd/smb2_process.c b/source3/smbd/smb2_process.c index 5f953c70e36..8c6e64403fb 100644 --- a/source3/smbd/smb2_process.c +++ b/source3/smbd/smb2_process.c @@ -64,6 +64,9 @@ struct pending_message_list { struct deferred_open_record *open_rec; }; +static struct pending_message_list *get_deferred_open_message_smb( + struct smbd_server_connection *sconn, uint64_t mid); + #if !defined(WITH_SMB1SERVER) static bool smb2_srv_send(struct smbXsrv_connection *xconn, char *buffer, bool do_signing, uint32_t seqnum, @@ -414,3 +417,49 @@ bool open_was_deferred(struct smbXsrv_connection *xconn, uint64_t mid) } return False; } + +/**************************************************************************** + Return the message queued by this mid. +****************************************************************************/ + +static struct pending_message_list *get_deferred_open_message_smb( + struct smbd_server_connection *sconn, uint64_t mid) +{ + struct pending_message_list *pml; + + for (pml = sconn->deferred_open_queue; pml; pml = pml->next) { + if (((uint64_t)SVAL(pml->buf.data,smb_mid)) == mid) { + return pml; + } + } + return NULL; +} + +/**************************************************************************** + Get the state data queued by this mid. +****************************************************************************/ + +bool get_deferred_open_message_state(struct smb_request *smbreq, + struct timeval *p_request_time, + struct deferred_open_record **open_rec) +{ + struct pending_message_list *pml; + + if (smbreq->sconn->using_smb2) { + return get_deferred_open_message_state_smb2(smbreq->smb2req, + p_request_time, + open_rec); + } + + pml = get_deferred_open_message_smb(smbreq->sconn, smbreq->mid); + if (!pml) { + return false; + } + if (p_request_time) { + *p_request_time = pml->request_time; + } + if (open_rec != NULL) { + *open_rec = pml->open_rec; + } + return true; +}