From a87c9a92df675173fc28404819d8dc0303eb81af Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 4 Oct 2019 14:30:17 +0200 Subject: [PATCH] smb2_server: let smbd_server_connection_terminate_ex() call smbXsrv_connection_disconnect_transport() If the connection is broken mark it as invalid and close the socket. Signed-off-by: Stefan Metzmacher Reviewed-by: Guenther Deschner --- source3/smbd/smb2_server.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index de3eb9d22ce..648950249de 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1127,6 +1127,15 @@ void smbd_server_connection_terminate_ex(struct smbXsrv_connection *xconn, { struct smbXsrv_client *client = xconn->client; + /* + * Make sure that no new request will be able to use this session. + * + * smbXsrv_connection_disconnect_transport() might be called already, + * but calling it again is a no-op. + */ + smbXsrv_connection_disconnect_transport(xconn, + NT_STATUS_CONNECTION_DISCONNECTED); + DEBUG(10,("smbd_server_connection_terminate_ex: conn[%s] reason[%s] at %s\n", smbXsrv_connection_dbg(xconn), reason, location)); @@ -1134,7 +1143,6 @@ void smbd_server_connection_terminate_ex(struct smbXsrv_connection *xconn, /* TODO: cancel pending requests */ DLIST_REMOVE(client->connections, xconn); TALLOC_FREE(xconn); - DO_PROFILE_INC(disconnect); return; } -- 2.34.1