TODO: s3:smb2_server: let smbd_server_connection_terminate() only call exit_server...
authorStefan Metzmacher <metze@samba.org>
Thu, 18 Sep 2014 17:27:42 +0000 (19:27 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 15 May 2015 09:46:53 +0000 (11:46 +0200)
TODO: we need to cancel pending requests on the connection and defer the talloc_free

source3/smbd/smb2_server.c

index 7097cda45078ffd28aa286f6f445088ccfd4914b..720ea5ee1fe01553882c4883279a52d7e7633cf5 100644 (file)
@@ -1057,8 +1057,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);
 }