From 905ede6c6d3366aa10098f83d8d248b7ce4e0c8f Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 30 Apr 2012 14:49:41 +0200 Subject: [PATCH] wininet: Use hostname stored in server_t in NETCON_secure_connect. --- dlls/wininet/http.c | 2 +- dlls/wininet/internet.h | 2 +- dlls/wininet/netconnection.c | 20 ++------------------ 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 69068bffdc3..54db1185e9e 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -4616,7 +4616,7 @@ static DWORD open_http_connection(http_request_t *request, BOOL *reusing) if(session->appInfo->proxy) res = HTTP_SecureProxyConnect(request); if(res == ERROR_SUCCESS) - res = NETCON_secure_connect(request->netconn, session->hostName); + res = NETCON_secure_connect(request->netconn); if(res != ERROR_SUCCESS) { WARN("Couldn't connect securely to host\n"); diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 720b330717a..6cf1f38d19f 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -525,7 +525,7 @@ BOOL INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto, WCHAR *foundP DWORD create_netconn(BOOL, server_t *, DWORD, DWORD, netconn_t **) DECLSPEC_HIDDEN; void free_netconn(netconn_t*) DECLSPEC_HIDDEN; void NETCON_unload(void) DECLSPEC_HIDDEN; -DWORD NETCON_secure_connect(netconn_t *connection, LPWSTR hostname) DECLSPEC_HIDDEN; +DWORD NETCON_secure_connect(netconn_t *connection) DECLSPEC_HIDDEN; DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags, int *sent /* out */) DECLSPEC_HIDDEN; DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags, diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index 870b317e3ad..4d3e13f60c1 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -114,7 +114,6 @@ static const SSL_METHOD *meth; static SSL_METHOD *meth; #endif static SSL_CTX *ctx; -static int hostname_idx; static int error_idx; static int conn_idx; @@ -309,7 +308,6 @@ static DWORD netconn_verify_cert(PCCERT_CONTEXT cert, HCERTSTORE store, static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx) { SSL *ssl; - WCHAR *server; BOOL ret = FALSE; HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL); @@ -317,7 +315,6 @@ static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx) ssl = pX509_STORE_CTX_get_ex_data(ctx, pSSL_get_ex_data_X509_STORE_CTX_idx()); - server = pSSL_get_ex_data(ssl, hostname_idx); conn = pSSL_get_ex_data(ssl, conn_idx); if (store) { @@ -342,7 +339,7 @@ static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx) if (!endCert) ret = FALSE; if (ret) { - DWORD_PTR err = netconn_verify_cert(endCert, store, server, + DWORD_PTR err = netconn_verify_cert(endCert, store, conn->server->name, conn->security_flags); if (err) @@ -457,12 +454,6 @@ static DWORD init_openssl(void) return ERROR_OUTOFMEMORY; } - hostname_idx = pSSL_get_ex_new_index(0, (void *)"hostname index", NULL, NULL, NULL); - if(hostname_idx == -1) { - ERR("SSL_get_ex_new_index failed; %s\n", pERR_error_string(pERR_get_error(), 0)); - return ERROR_OUTOFMEMORY; - } - error_idx = pSSL_get_ex_new_index(0, (void *)"error index", NULL, NULL, NULL); if(error_idx == -1) { ERR("SSL_get_ex_new_index failed; %s\n", pERR_error_string(pERR_get_error(), 0)); @@ -692,7 +683,7 @@ int sock_get_error( int err ) * NETCON_secure_connect * Initiates a secure connection over an existing plaintext connection. */ -DWORD NETCON_secure_connect(netconn_t *connection, LPWSTR hostname) +DWORD NETCON_secure_connect(netconn_t *connection) { DWORD res = ERROR_NOT_SUPPORTED; #ifdef SONAME_LIBSSL @@ -721,13 +712,6 @@ DWORD NETCON_secure_connect(netconn_t *connection, LPWSTR hostname) goto fail; } - if (!pSSL_set_ex_data(ssl_s, hostname_idx, hostname)) - { - ERR("SSL_set_ex_data failed: %s\n", - pERR_error_string(pERR_get_error(), 0)); - res = ERROR_INTERNET_SECURITY_CHANNEL_ERROR; - goto fail; - } if (!pSSL_set_ex_data(ssl_s, conn_idx, connection)) { ERR("SSL_set_ex_data failed: %s\n", -- 2.11.4.GIT