summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/smb_server/smb')
-rw-r--r--source4/smb_server/smb/reply.c23
-rw-r--r--source4/smb_server/smb/request.c8
-rw-r--r--source4/smb_server/smb/service.c1
3 files changed, 26 insertions, 6 deletions
diff --git a/source4/smb_server/smb/reply.c b/source4/smb_server/smb/reply.c
index 75830ae73a..c79ad15ea8 100644
--- a/source4/smb_server/smb/reply.c
+++ b/source4/smb_server/smb/reply.c
@@ -633,7 +633,6 @@ void smbsrv_reply_readbraw(struct smbsrv_request *req)
req->ntvfs = ntvfs_request_create(req->tcon->ntvfs, req,
req->session->session_info,
SVAL(req->in.hdr,HDR_PID),
- SVAL(req->in.hdr,HDR_MID),
req->request_time,
req, NULL, 0);
if (!req->ntvfs) {
@@ -2197,10 +2196,24 @@ void smbsrv_reply_ntcreate_and_X(struct smbsrv_request *req)
****************************************************************************/
void smbsrv_reply_ntcancel(struct smbsrv_request *req)
{
- /* NOTE: this request does not generate a reply */
- SMBSRV_SETUP_NTVFS_REQUEST(NULL,0);
- ntvfs_cancel(req->ntvfs);
- talloc_free(req);
+ struct smbsrv_request *r;
+ uint16_t mid = SVAL(req->in.hdr,HDR_MID);
+ uint16_t pid = SVAL(req->in.hdr,HDR_PID);
+
+ for (r = req->smb_conn->requests; r; r = r->next) {
+ if (mid != SVAL(r->in.hdr,HDR_MID)) continue;
+ /* do we really need to check the PID? */
+ if (pid != SVAL(r->in.hdr,HDR_PID)) continue;
+
+ SMBSRV_CHECK(ntvfs_cancel(r->ntvfs));
+
+ /* NOTE: this request does not generate a reply */
+ talloc_free(req);
+ return;
+ }
+
+ /* TODO: workout the correct error code */
+ smbsrv_send_error(req, NT_STATUS_FOOBAR);
}
/*
diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c
index a08ae46852..fc7d060ea8 100644
--- a/source4/smb_server/smb/request.c
+++ b/source4/smb_server/smb/request.c
@@ -33,6 +33,12 @@
/* we over allocate the data buffer to prevent too many realloc calls */
#define REQ_OVER_ALLOCATION 0
+static int smbsrv_request_destructor(struct smbsrv_request *req)
+{
+ DLIST_REMOVE(req->smb_conn->requests, req);
+ return 0;
+}
+
/****************************************************************************
construct a basic request packet, mostly used to construct async packets
such as change notify and oplock break requests
@@ -49,6 +55,8 @@ struct smbsrv_request *smbsrv_init_request(struct smbsrv_connection *smb_conn)
/* setup the request context */
req->smb_conn = smb_conn;
+ talloc_set_destructor(req, smbsrv_request_destructor);
+
return req;
}
diff --git a/source4/smb_server/smb/service.c b/source4/smb_server/smb/service.c
index 676f417619..92967d858c 100644
--- a/source4/smb_server/smb/service.c
+++ b/source4/smb_server/smb/service.c
@@ -89,7 +89,6 @@ static NTSTATUS make_connection_snum(struct smbsrv_request *req,
req->ntvfs = ntvfs_request_create(req->tcon->ntvfs, req,
req->session->session_info,
SVAL(req->in.hdr,HDR_PID),
- SVAL(req->in.hdr,HDR_MID),
req->request_time,
req, NULL, 0);
if (!req->ntvfs) {