wininet: Fail in NETCON_secure_connect instead of create_netconn if OpenSSL is not available.
This commit is contained in:
parent
42750e340e
commit
85991a7cdd
|
@ -463,7 +463,6 @@ static long get_tls_option(void) {
|
||||||
#endif
|
#endif
|
||||||
return tls_option;
|
return tls_option;
|
||||||
}
|
}
|
||||||
#endif /* SONAME_LIBSSL */
|
|
||||||
|
|
||||||
static CRITICAL_SECTION init_ssl_cs;
|
static CRITICAL_SECTION init_ssl_cs;
|
||||||
static CRITICAL_SECTION_DEBUG init_ssl_cs_debug =
|
static CRITICAL_SECTION_DEBUG init_ssl_cs_debug =
|
||||||
|
@ -477,7 +476,7 @@ static CRITICAL_SECTION init_ssl_cs = { &init_ssl_cs_debug, -1, 0, 0, 0, 0 };
|
||||||
|
|
||||||
static DWORD init_openssl(void)
|
static DWORD init_openssl(void)
|
||||||
{
|
{
|
||||||
#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO)
|
#ifdef SONAME_LIBCRYPTO
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(OpenSSL_ssl_handle)
|
if(OpenSSL_ssl_handle)
|
||||||
|
@ -600,10 +599,11 @@ static DWORD init_openssl(void)
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
#else
|
#else
|
||||||
FIXME("can't use SSL, not compiled in.\n");
|
FIXME("can't use SSL, libcrypto not compiled in.\n");
|
||||||
return ERROR_INTERNET_SECURITY_CHANNEL_ERROR;
|
return ERROR_INTERNET_SECURITY_CHANNEL_ERROR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* SONAME_LIBSSL */
|
||||||
|
|
||||||
static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD timeout)
|
static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD timeout)
|
||||||
{
|
{
|
||||||
|
@ -663,6 +663,7 @@ DWORD create_netconn(BOOL useSSL, server_t *server, DWORD security_flags, BOOL m
|
||||||
netconn_t *netconn;
|
netconn_t *netconn;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
#ifdef SONAME_LIBSSL
|
||||||
if(useSSL) {
|
if(useSSL) {
|
||||||
DWORD res;
|
DWORD res;
|
||||||
|
|
||||||
|
@ -674,6 +675,7 @@ DWORD create_netconn(BOOL useSSL, server_t *server, DWORD security_flags, BOOL m
|
||||||
if(res != ERROR_SUCCESS)
|
if(res != ERROR_SUCCESS)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
netconn = heap_alloc_zero(sizeof(*netconn));
|
netconn = heap_alloc_zero(sizeof(*netconn));
|
||||||
if(!netconn)
|
if(!netconn)
|
||||||
|
@ -910,6 +912,8 @@ DWORD NETCON_secure_connect(netconn_t *connection, server_t *server)
|
||||||
res = netcon_secure_connect_setup(connection, get_tls_option()|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2);
|
res = netcon_secure_connect_setup(connection, get_tls_option()|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
FIXME("Cannot connect, OpenSSL not available.\n");
|
||||||
#endif
|
#endif
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -943,6 +947,7 @@ DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
|
||||||
return ERROR_INTERNET_CONNECTION_ABORTED;
|
return ERROR_INTERNET_CONNECTION_ABORTED;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
#else
|
#else
|
||||||
|
FIXME("not supported on this platform\n");
|
||||||
return ERROR_NOT_SUPPORTED;
|
return ERROR_NOT_SUPPORTED;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -980,6 +985,7 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags,
|
||||||
|
|
||||||
return *recvd > 0 ? ERROR_SUCCESS : ERROR_INTERNET_CONNECTION_ABORTED;
|
return *recvd > 0 ? ERROR_SUCCESS : ERROR_INTERNET_CONNECTION_ABORTED;
|
||||||
#else
|
#else
|
||||||
|
FIXME("not supported on this platform\n");
|
||||||
return ERROR_NOT_SUPPORTED;
|
return ERROR_NOT_SUPPORTED;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1010,6 +1016,9 @@ BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available)
|
||||||
{
|
{
|
||||||
#ifdef SONAME_LIBSSL
|
#ifdef SONAME_LIBSSL
|
||||||
*available = connection->ssl_s ? pSSL_pending(connection->ssl_s) : 0;
|
*available = connection->ssl_s ? pSSL_pending(connection->ssl_s) : 0;
|
||||||
|
#else
|
||||||
|
FIXME("not supported on this platform\n");
|
||||||
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1058,6 +1067,7 @@ LPCVOID NETCON_GetCert(netconn_t *connection)
|
||||||
r = X509_to_cert_context(cert);
|
r = X509_to_cert_context(cert);
|
||||||
return r;
|
return r;
|
||||||
#else
|
#else
|
||||||
|
FIXME("not supported on this platform\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1080,6 +1090,7 @@ int NETCON_GetCipherStrength(netconn_t *connection)
|
||||||
pSSL_CIPHER_get_bits(cipher, &bits);
|
pSSL_CIPHER_get_bits(cipher, &bits);
|
||||||
return bits;
|
return bits;
|
||||||
#else
|
#else
|
||||||
|
FIXME("not supported on this platform\n");
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue