s3:smbd: use smbXsrv_session_logoff() in smbd_smb2_request_process_logoff()
authorMichael Adam <obnox@samba.org>
Tue, 22 May 2012 09:58:26 +0000 (11:58 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2012 09:53:46 +0000 (11:53 +0200)
This removes uses of close_cnum() and file_close_user().

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

source3/smbd/smb2_sesssetup.c

index 2e2348e39c0f5275127ed8dbd073c8a7ac36b1df..8a7a906930080549a08458f6bed081f1e7ccfcd1 100644 (file)
@@ -661,7 +661,6 @@ NTSTATUS smbd_smb2_request_process_logoff(struct smbd_smb2_request *req)
 {
        NTSTATUS status;
        DATA_BLOB outbody;
-       struct connection_struct *conn, *next_conn;
 
        status = smbd_smb2_request_verify_sizes(req, 0x04);
        if (!NT_STATUS_IS_OK(status)) {
@@ -671,30 +670,18 @@ NTSTATUS smbd_smb2_request_process_logoff(struct smbd_smb2_request *req)
        /*
         * TODO: cancel all outstanding requests on the session
         */
-       file_close_user(req->sconn, req->session->compat->vuid);
-
-       for (conn=req->sconn->connections; conn; conn=next_conn) {
-               struct smbXsrv_tcon *tcon;
-
-               next_conn = conn->next;
-               tcon = conn->tcon;
-
-               if (conn->vuid != req->session->compat->vuid) {
-                       continue;
-               }
-
-               set_current_service(conn, 0, True);
-               close_cnum(conn, conn->vuid);
-
-               /* for now tcon is NULL for SMB1 */
-               TALLOC_FREE(tcon);
+       status = smbXsrv_session_logoff(req->session);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("smbd_smb2_request_process_logoff: "
+                         "smbXsrv_session_logoff() failed: %s\n",
+                         nt_errstr(status)));
+               /*
+                * If we hit this case, there is something completely
+                * wrong, so we better disconnect the transport connection.
+                */
+               return status;
        }
 
-       invalidate_vuid(req->sconn, req->session->compat->vuid);
-       req->session->compat = NULL;
-
-       req->session->status = NT_STATUS_USER_SESSION_DELETED;
-
        /*
         * we may need to sign the response, so we need to keep
         * the session until the response is sent to the wire.