Loweynet
Revision | 36d3d8b9ff40fcc9ec7f84bd406d9ccdd0bf3c24 (tree) |
---|---|
Zeit | 2011-10-16 02:42:25 |
Autor | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Fix bugs of SSL connection management.
@@ -2837,10 +2837,15 @@ BOOL __stdcall SSLConfirmCallback(BOOL bVerified, LPCSTR Certificate, LPCSTR Com | ||
2837 | 2837 | char* pm0; |
2838 | 2838 | bResult = FALSE; |
2839 | 2839 | sha_memory((char*)Certificate, (uint32)(strlen(Certificate) * sizeof(char)), (uint32*)&Hash); |
2840 | - for(i = 0; i < MAX_CERT_CACHE_HASH; i++) | |
2840 | + i = 0; | |
2841 | + while(i < MAX_CERT_CACHE_HASH) | |
2841 | 2842 | { |
2842 | 2843 | if(memcmp(&CertificateCacheHash[i], &Hash, 20) == 0) |
2844 | + { | |
2843 | 2845 | bResult = TRUE; |
2846 | + break; | |
2847 | + } | |
2848 | + i++; | |
2844 | 2849 | } |
2845 | 2850 | if(!bResult) |
2846 | 2851 | { |
@@ -381,13 +381,18 @@ BOOL AttachSSL(SOCKET s, SOCKET parent) | ||
381 | 381 | } |
382 | 382 | EnterCriticalSection(&g_OpenSSLLock); |
383 | 383 | } |
384 | - if(ConfirmSSLCertificate(*ppSSL)) | |
384 | + if(r) | |
385 | 385 | { |
386 | - } | |
387 | - else | |
388 | - { | |
389 | - DetachSSL(s); | |
390 | - r = FALSE; | |
386 | + if(ConfirmSSLCertificate(*ppSSL)) | |
387 | + { | |
388 | + } | |
389 | + else | |
390 | + { | |
391 | + LeaveCriticalSection(&g_OpenSSLLock); | |
392 | + DetachSSL(s); | |
393 | + r = FALSE; | |
394 | + EnterCriticalSection(&g_OpenSSLLock); | |
395 | + } | |
391 | 396 | } |
392 | 397 | } |
393 | 398 | else |
@@ -431,7 +436,7 @@ BOOL IsSSLAttached(SOCKET s) | ||
431 | 436 | ppSSL = FindSSLPointerFromSocket(s); |
432 | 437 | LeaveCriticalSection(&g_OpenSSLLock); |
433 | 438 | if(!ppSSL) |
434 | - return TRUE; | |
439 | + return FALSE; | |
435 | 440 | return TRUE; |
436 | 441 | } |
437 | 442 |