s3:smbd: use smbXsrv_tcon_disconnect() in handle_trans()
authorMichael Adam <obnox@samba.org>
Tue, 22 May 2012 11:13:07 +0000 (13:13 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2012 09:53:47 +0000 (11:53 +0200)
This removes a direct use of close_cnum().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

source3/smbd/ipc.c

index 91c1d329e97a25f65ec7f910b21be6e533a25938..f0f49bd7e1bf0d6726b6426938d9eb9834a1e629 100644 (file)
@@ -631,11 +631,29 @@ static void handle_trans(connection_struct *conn, struct smb_request *req,
 
        if (state->close_on_completion) {
                struct smbXsrv_tcon *tcon;
+               NTSTATUS status;
+
                tcon = conn->tcon;
-               close_cnum(conn,state->vuid);
-               tcon->compat = NULL;
-               TALLOC_FREE(tcon);
                req->conn = NULL;
+               conn = NULL;
+
+               /*
+                * TODO: cancel all outstanding requests on the tcon
+                */
+               status = smbXsrv_tcon_disconnect(tcon);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("handle_trans: "
+                                 "smbXsrv_tcon_disconnect() failed: %s\n",
+                                 nt_errstr(status)));
+                       /*
+                        * If we hit this case, there is something completely
+                        * wrong, so we better disconnect the transport connection.
+                        */
+                       exit_server(__location__ ": smbXsrv_tcon_disconnect failed");
+                       return;
+               }
+
+               TALLOC_FREE(tcon);
        }
 
        return;