diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/smb_server/smb/request.c | 6 | ||||
-rw-r--r-- | source4/smb_server/smb2/receive.c | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c index fc7d060ea8..00bed16fc4 100644 --- a/source4/smb_server/smb/request.c +++ b/source4/smb_server/smb/request.c @@ -289,6 +289,7 @@ void smbsrv_send_reply_nosign(struct smbsrv_request *req) if (req->smb_conn->connection->event.fde == NULL) { /* we are in the process of shutting down this connection */ + talloc_free(req); return; } @@ -312,6 +313,11 @@ void smbsrv_send_reply_nosign(struct smbsrv_request *req) */ void smbsrv_send_reply(struct smbsrv_request *req) { + if (req->smb_conn->connection->event.fde == NULL) { + /* we are in the process of shutting down this connection */ + talloc_free(req); + return; + } smbsrv_sign_packet(req); smbsrv_send_reply_nosign(req); diff --git a/source4/smb_server/smb2/receive.c b/source4/smb_server/smb2/receive.c index 80b626a78a..0f8eb101cf 100644 --- a/source4/smb_server/smb2/receive.c +++ b/source4/smb_server/smb2/receive.c @@ -26,6 +26,7 @@ #include "smb_server/smb_server.h" #include "smb_server/service_smb_proto.h" #include "smb_server/smb2/smb2_server.h" +#include "smbd/service_stream.h" #include "lib/stream/packet.h" @@ -98,6 +99,12 @@ void smb2srv_send_reply(struct smb2srv_request *req) DATA_BLOB blob; NTSTATUS status; + if (req->smb_conn->connection->event.fde == NULL) { + /* the socket has been destroyed - no point trying to send a reply! */ + talloc_free(req); + return; + } + if (req->out.size > NBT_HDR_SIZE) { _smb2_setlen(req->out.buffer, req->out.size - NBT_HDR_SIZE); } @@ -114,6 +121,12 @@ void smb2srv_send_error(struct smb2srv_request *req, NTSTATUS error) { NTSTATUS status; + if (req->smb_conn->connection->event.fde == NULL) { + /* the socket has been destroyed - no point trying to send an error! */ + talloc_free(req); + return; + } + status = smb2srv_setup_reply(req, 8, True, 0); if (!NT_STATUS_IS_OK(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); |