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

smbd: Move remove_deferred_open_message_smb 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-18 12:28:19 -06:00 committed by Jeremy Allison
parent 7e55512a3b
commit 4a4be53530
3 changed files with 45 additions and 30 deletions

View File

@ -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.

View File

@ -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 */

View File

@ -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;
}
}
}