From cfbf4509003639885850d626a62684e2652347a4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 18 Sep 2014 19:27:42 +0200 Subject: [PATCH] smbd:smb2_server: let smbd_server_connection_terminate() only call exit_server() for the last connection TODO: We need to cancel pending requests on the connection and defer the talloc_free. Currently we only ever have one connection. Signed-off-by: Stefan Metzmacher Signed-off-by: Michael Adam --- source3/smbd/smb2_server.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 9adbb996067..58f933b3c00 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1059,8 +1059,21 @@ void smbd_server_connection_terminate_ex(struct smbXsrv_connection *xconn, const char *reason, const char *location) { - DEBUG(10,("smbd_server_connection_terminate_ex: reason[%s] at %s\n", - reason, location)); + struct smbXsrv_client *client = xconn->client; + + DEBUG(10,("smbd_server_connection_terminate_ex: conn[%s] reason[%s] at %s\n", + smbXsrv_connection_dbg(xconn), reason, location)); + + if (client->connections->next != NULL) { + /* TODO: cancel pending requests */ + DLIST_REMOVE(client->connections, xconn); + TALLOC_FREE(xconn); + return; + } + + /* + * The last connection was disconnected + */ exit_server_cleanly(reason); } -- 2.34.1