smb2srv: sign SMB2 Logoff replies
authorStefan Metzmacher <metze@samba.org>
Mon, 9 Jun 2008 19:57:05 +0000 (21:57 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 28 Jul 2008 12:09:46 +0000 (14:09 +0200)
metze
(This used to be commit 2844e361730a6bc640ea89d0e10059deca1ca867)

source4/smb_server/smb2/sesssetup.c

index 6e3e96379457e1056d8089c0aead212afd4a710a..9f8765d6e9461069532ad9ba8b08ec251467c883 100644 (file)
@@ -224,11 +224,25 @@ void smb2srv_sesssetup_recv(struct smb2srv_request *req)
        smb2srv_sesssetup_backend(req, io);
 }
 
-static NTSTATUS smb2srv_logoff_backend(struct smb2srv_request *req)
+static int smb2srv_cleanup_session_destructor(struct smbsrv_session **session)
 {
        /* TODO: call ntvfs backends to close file of this session */
-       talloc_free(req->session);
-       req->session = NULL;
+       DEBUG(0,("free session[%p]\n", *session));
+       talloc_free(*session);
+       return 0;
+}
+
+static NTSTATUS smb2srv_logoff_backend(struct smb2srv_request *req)
+{
+       struct smbsrv_session **session_ptr;
+
+       /* we need to destroy the session after sending the reply */
+       session_ptr = talloc(req, struct smbsrv_session *);
+       NT_STATUS_HAVE_NO_MEMORY(session_ptr);
+
+       *session_ptr = req->session;
+       talloc_set_destructor(session_ptr, smb2srv_cleanup_session_destructor);
+
        return NT_STATUS_OK;
 }