diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/OpenSSL/src/ssl_openssl.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/plugins/OpenSSL/src/ssl_openssl.cpp b/plugins/OpenSSL/src/ssl_openssl.cpp index 78ed29bd69..4e910d24ea 100644 --- a/plugins/OpenSSL/src/ssl_openssl.cpp +++ b/plugins/OpenSSL/src/ssl_openssl.cpp @@ -480,28 +480,29 @@ cleanup: SslHandle *NetlibSslConnect(SOCKET s, const char* host, int verify) { - SslHandle *ssl = (SslHandle*)mir_calloc(sizeof(SslHandle)); - ssl->s = s; /* negotiate SSL session, verify cert, return NULL if failed */ - - DWORD dwFlags = 0; - if (!host || inet_addr(host) != INADDR_NONE) - dwFlags |= 0x00001000; - bool res = SSL_library_load(); - if (!res) { + if (!res) return NULL; - } + + SslHandle *ssl = (SslHandle*)mir_calloc(sizeof(SslHandle)); + ssl->s = s; + res = ClientConnect(ssl, host); - if (res) res = ClientConnect(ssl, host); - if (res && verify) res = VerifyCertificate(ssl, host, dwFlags); + if (res && verify) { + DWORD dwFlags = 0; + if (!host || inet_addr(host) != INADDR_NONE) + dwFlags |= 0x00001000; + res = VerifyCertificate(ssl, host, dwFlags); + } - if (!res) - { + if(res) { + return ssl; + } + else { NetlibSslFree(ssl); - ssl = NULL; + return NULL; } - return ssl; } void NetlibSslShutdown(SslHandle *ssl) |