Anton Romanov : secur32: Protect SSLRead/Write with cs on OSX.
Module: wine Branch: stable Commit: 6febb8cc97a17027842811d5634aad7204f5c8af URL: https://source.winehq.org/git/wine.git/?a=commit;h=6febb8cc97a17027842811d56... Author: Anton Romanov <theli.ua(a)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(a)gmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 1dbf6c8f54c17e50852470caf88febb816aad4fa) Signed-off-by: Michael Stefaniuc <mstefani(a)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 fdfa48e..3dd8fda 100644 --- a/dlls/secur32/schannel_macosx.c +++ b/dlls/secur32/schannel_macosx.c @@ -146,6 +146,7 @@ enum { struct mac_session { SSLContextRef context; struct schan_transport *transport; + CRITICAL_SECTION cs; }; @@ -660,6 +661,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) { @@ -721,6 +725,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); } @@ -946,7 +951,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) @@ -976,7 +983,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)
participants (1)
-
Alexandre Julliard