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)
committerStefan Metzmacher <metze@samba.org>
Tue, 28 Jan 2020 12:26:51 +0000 (13:26 +0100)
If the connection is broken mark it as invalid and close
the socket.

source3/smbd/smb2_server.c

index 86454d8e59329f97ca16c2b066faf9d23f7901c4..23f92b980c665e061aa46d2f98b209ca98cfc0ad 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(0, ("smbd_server_connection_terminate_ex: client[%p] xconn[%p] conn[%s] reason[%s] at %s\n",
                  client, xconn, 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;
        }