From: David Mulder Date: Fri, 18 Mar 2022 18:28:19 +0000 (-0600) Subject: smbd: Move remove_deferred_open_message_smb to smb2_process.c X-Git-Tag: tevent-0.12.0~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a4be53530d02588b23b3f95c9b3da255efb0211;p=thirdparty%2Fsamba.git smbd: Move remove_deferred_open_message_smb 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 5f9a8de58cb..8eeb1258681 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -726,34 +726,6 @@ static bool push_queued_message(struct smb_request *req, return True; } -/**************************************************************************** - Function to delete a sharing violation open message by mid. -****************************************************************************/ - -void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn, - uint64_t mid) -{ - struct smbd_server_connection *sconn = xconn->client->sconn; - struct pending_message_list *pml; - - if (sconn->using_smb2) { - remove_deferred_open_message_smb2(xconn, mid); - return; - } - - for (pml = sconn->deferred_open_queue; pml; pml = pml->next) { - if (mid == (uint64_t)SVAL(pml->buf.data,smb_mid)) { - DEBUG(10,("remove_deferred_open_message_smb: " - "deleting mid %llu len %u\n", - (unsigned long long)mid, - (unsigned int)pml->buf.length )); - DLIST_REMOVE(sconn->deferred_open_queue, pml); - TALLOC_FREE(pml); - return; - } - } -} - /**************************************************************************** Move a sharing violation open retry message to the front of the list and schedule it for immediate processing. diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 122d343b779..5811ad0f55c 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -852,8 +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); -void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn, - uint64_t mid); bool schedule_deferred_open_message_smb(struct smbXsrv_connection *xconn, uint64_t mid); bool open_was_deferred(struct smbXsrv_connection *xconn, uint64_t mid); @@ -918,6 +916,8 @@ NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx, size_t *p_len, uint32_t *seqnum, bool trusted_channel); +void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn, + uint64_t mid); /* The following definitions come from smbd/quotas.c */ diff --git a/source3/smbd/smb2_process.c b/source3/smbd/smb2_process.c index 1ba3836c8a3..fa590efa881 100644 --- a/source3/smbd/smb2_process.c +++ b/source3/smbd/smb2_process.c @@ -49,6 +49,21 @@ #include "smb1_utils.h" #include "source3/lib/substitute.h" +/* Internal message queue for deferred opens. */ +struct pending_message_list { + struct pending_message_list *next, *prev; + struct timeval request_time; /* When was this first issued? */ + struct smbd_server_connection *sconn; + struct smbXsrv_connection *xconn; + struct tevent_timer *te; + struct smb_perfcount_data pcd; + uint32_t seqnum; + bool encrypted; + bool processed; + DATA_BLOB buf; + struct deferred_open_record *open_rec; +}; + #if !defined(WITH_SMB1SERVER) static bool smb2_srv_send(struct smbXsrv_connection *xconn, char *buffer, bool do_signing, uint32_t seqnum, @@ -237,3 +252,31 @@ NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx, trusted_channel); #endif } + +/**************************************************************************** + Function to delete a sharing violation open message by mid. +****************************************************************************/ + +void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn, + uint64_t mid) +{ + struct smbd_server_connection *sconn = xconn->client->sconn; + struct pending_message_list *pml; + + if (sconn->using_smb2) { + remove_deferred_open_message_smb2(xconn, mid); + return; + } + + for (pml = sconn->deferred_open_queue; pml; pml = pml->next) { + if (mid == (uint64_t)SVAL(pml->buf.data,smb_mid)) { + DEBUG(10,("remove_deferred_open_message_smb: " + "deleting mid %llu len %u\n", + (unsigned long long)mid, + (unsigned int)pml->buf.length )); + DLIST_REMOVE(sconn->deferred_open_queue, pml); + TALLOC_FREE(pml); + return; + } + } +}