smb2_server: let smbd_server_connection_terminate_ex() call smbXsrv_connection_discon...
authorStefan Metzmacher <metze@samba.org>
Fri, 4 Oct 2019 12:30:17 +0000 (14:30 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 15 May 2020 09:04:36 +0000 (09:04 +0000)
If the connection is broken mark it as invalid and close
the socket.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/smbd/smb2_server.c

index de3eb9d22ce4cc8372665d00a4ec03c51c507208..648950249de2f40b8265045299807190b5c4f615 100644 (file)
@@ -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;
        }