Anton Romanov : secur32: Protect SSLRead/Write with cs on OSX.
Alexandre Julliard
julliard at winehq.org
Mon Sep 18 14:43:49 CDT 2017
Module: wine
Branch: master
Commit: 1dbf6c8f54c17e50852470caf88febb816aad4fa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1dbf6c8f54c17e50852470caf88febb816aad4fa
Author: Anton Romanov <theli.ua at gmail.com>
Date: Fri Sep 15 22:40:03 2017 -0700
secur32: Protect SSLRead/Write with cs on OSX.
Signed-off-by: Anton Romanov <theli.ua at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/secur32/schannel_macosx.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dlls/secur32/schannel_macosx.c b/dlls/secur32/schannel_macosx.c
index 7f38133..015de92 100644
--- a/dlls/secur32/schannel_macosx.c
+++ b/dlls/secur32/schannel_macosx.c
@@ -185,6 +185,7 @@ enum {
struct mac_session {
SSLContextRef context;
struct schan_transport *transport;
+ CRITICAL_SECTION cs;
};
@@ -742,6 +743,9 @@ BOOL schan_imp_create_session(schan_imp_session *session, schan_credentials *cre
if (!s)
return FALSE;
+ InitializeCriticalSection(&s->cs);
+ s->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": mac_session.cs");
+
status = SSLNewContext(cred->credential_use == SECPKG_CRED_INBOUND, &s->context);
if (status != noErr)
{
@@ -803,6 +807,7 @@ void schan_imp_dispose_session(schan_imp_session session)
status = SSLDisposeContext(s->context);
if (status != noErr)
ERR("Failed to dispose of session context: %d\n", status);
+ DeleteCriticalSection(&s->cs);
HeapFree(GetProcessHeap(), 0, s);
}
@@ -1090,7 +1095,9 @@ SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->context, buffer, length, *length);
+ EnterCriticalSection(&s->cs);
status = SSLWrite(s->context, buffer, *length, length);
+ LeaveCriticalSection(&s->cs);
if (status == noErr)
TRACE("Wrote %lu bytes\n", *length);
else if (status == errSSLWouldBlock)
@@ -1120,7 +1127,9 @@ SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer,
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->context, buffer, length, *length);
+ EnterCriticalSection(&s->cs);
status = SSLRead(s->context, buffer, *length, length);
+ LeaveCriticalSection(&s->cs);
if (status == noErr || status == errSSLClosedGraceful)
TRACE("Read %lu bytes\n", *length);
else if (status == errSSLWouldBlock)
More information about the wine-cvs
mailing list