Kai Blin : secur32:
Delete session key and arc4 context when the session based security
context is deleted .
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Nov 8 14:12:22 CST 2006
Module: wine
Branch: master
Commit: 6720a129f3a77a280e589660828855a06ccdd5e0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6720a129f3a77a280e589660828855a06ccdd5e0
Author: Kai Blin <kai.blin at gmail.com>
Date: Wed Nov 8 12:10:05 2006 +0100
secur32: Delete session key and arc4 context when the session based security context is deleted.
---
dlls/secur32/dispatcher.c | 1 -
dlls/secur32/ntlm.c | 32 ++++++++++++++++----------------
dlls/secur32/secur32_priv.h | 1 +
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/dlls/secur32/dispatcher.c b/dlls/secur32/dispatcher.c
index b7b9f9d..c150a14 100644
--- a/dlls/secur32/dispatcher.c
+++ b/dlls/secur32/dispatcher.c
@@ -258,7 +258,6 @@ void cleanup_helper(PNegoHelper helper)
return;
HeapFree(GetProcessHeap(), 0, helper->com_buf);
- HeapFree(GetProcessHeap(), 0, helper->session_key);
/* closing stdin will terminate ntlm_auth */
close(helper->pipe_out);
diff --git a/dlls/secur32/ntlm.c b/dlls/secur32/ntlm.c
index 8cc206d..2b3c02d 100644
--- a/dlls/secur32/ntlm.c
+++ b/dlls/secur32/ntlm.c
@@ -690,8 +690,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_In
}
TRACE("Session key is %s\n", debugstr_a(buffer+3));
helper->valid_session_key = TRUE;
- if(!helper->session_key)
- helper->session_key = HeapAlloc(GetProcessHeap(), 0, bin_len);
+ helper->session_key = HeapAlloc(GetProcessHeap(), 0, bin_len);
if(!helper->session_key)
{
TRACE("Failed to allocate memory for session key\n");
@@ -1036,8 +1035,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_Ac
}
TRACE("Session key is %s\n", debugstr_a(buffer+3));
helper->valid_session_key = TRUE;
- if(!helper->session_key)
- helper->session_key = HeapAlloc(GetProcessHeap(), 0, 16);
+ helper->session_key = HeapAlloc(GetProcessHeap(), 0, 16);
if(!helper->session_key)
{
TRACE("Failed to allocate memory for session key\n");
@@ -1081,20 +1079,22 @@ static SECURITY_STATUS SEC_ENTRY ntlm_Co
*/
static SECURITY_STATUS SEC_ENTRY ntlm_DeleteSecurityContext(PCtxtHandle phContext)
{
- SECURITY_STATUS ret;
+ PNegoHelper helper;
TRACE("%p\n", phContext);
- if (phContext)
- {
- phContext->dwUpper = 0;
- phContext->dwLower = 0;
- ret = SEC_E_OK;
- }
- else
- {
- ret = SEC_E_INVALID_HANDLE;
- }
- return ret;
+ if (!phContext)
+ return SEC_E_INVALID_HANDLE;
+
+ helper = (PNegoHelper)phContext->dwLower;
+
+ phContext->dwUpper = 0;
+ phContext->dwLower = 0;
+
+ SECUR32_arc4Cleanup(helper->crypt.ntlm.a4i);
+ HeapFree(GetProcessHeap(), 0, helper->session_key);
+ helper->valid_session_key = FALSE;
+
+ return SEC_E_OK;
}
/***********************************************************************
diff --git a/dlls/secur32/secur32_priv.h b/dlls/secur32/secur32_priv.h
index d2002fd..8a6a290 100644
--- a/dlls/secur32/secur32_priv.h
+++ b/dlls/secur32/secur32_priv.h
@@ -139,6 +139,7 @@ SECURITY_STATUS SECUR32_CreateNTLMv1Sess
arc4_info *SECUR32_arc4Alloc(void);
void SECUR32_arc4Init(arc4_info *a4i, const BYTE *key, unsigned int keyLen);
void SECUR32_arc4Process(arc4_info *a4i, BYTE *inoutString, unsigned int length);
+void SECUR32_arc4Cleanup(arc4_info *a4i);
/* NTLMSSP flags indicating the negotiated features */
#define NTLMSSP_NEGOTIATE_UNICODE 0x00000001
More information about the wine-cvs
mailing list