wininet: Don't unnecessarily convert hostname to ANSI to check it.
This commit is contained in:
parent
b6a5da06e9
commit
33e68268a4
|
@ -422,7 +422,7 @@ DWORD NETCON_close(WININET_NETCONNECTION *connection)
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
#ifdef SONAME_LIBSSL
|
#ifdef SONAME_LIBSSL
|
||||||
static BOOL check_hostname(X509 *cert, char *hostname)
|
static BOOL check_hostname(X509 *cert, LPCWSTR hostname)
|
||||||
{
|
{
|
||||||
/* FIXME: implement */
|
/* FIXME: implement */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -438,8 +438,6 @@ DWORD NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname)
|
||||||
#ifdef SONAME_LIBSSL
|
#ifdef SONAME_LIBSSL
|
||||||
long verify_res;
|
long verify_res;
|
||||||
X509 *cert;
|
X509 *cert;
|
||||||
int len;
|
|
||||||
char *hostname_unix;
|
|
||||||
|
|
||||||
/* can't connect if we are already connected */
|
/* can't connect if we are already connected */
|
||||||
if (connection->useSSL)
|
if (connection->useSSL)
|
||||||
|
@ -488,23 +486,12 @@ DWORD NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname)
|
||||||
* the moment */
|
* the moment */
|
||||||
}
|
}
|
||||||
|
|
||||||
len = WideCharToMultiByte(CP_UNIXCP, 0, hostname, -1, NULL, 0, NULL, NULL);
|
if (!check_hostname(cert, hostname))
|
||||||
hostname_unix = HeapAlloc(GetProcessHeap(), 0, len);
|
|
||||||
if (!hostname_unix)
|
|
||||||
{
|
{
|
||||||
res = ERROR_OUTOFMEMORY;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
WideCharToMultiByte(CP_UNIXCP, 0, hostname, -1, hostname_unix, len, NULL, NULL);
|
|
||||||
|
|
||||||
if (!check_hostname(cert, hostname_unix))
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, hostname_unix);
|
|
||||||
res = ERROR_INTERNET_SEC_CERT_CN_INVALID;
|
res = ERROR_INTERNET_SEC_CERT_CN_INVALID;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, hostname_unix);
|
|
||||||
connection->useSSL = TRUE;
|
connection->useSSL = TRUE;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue