Juan Lang : winhttp: Store hostname for secure connection in its SSL context.

Alexandre Julliard julliard at winehq.org
Fri Dec 4 09:11:26 CST 2009


Module: wine
Branch: master
Commit: be8f2ae98ee264a7855921fb63cad50ed22144f8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=be8f2ae98ee264a7855921fb63cad50ed22144f8

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Nov 12 13:33:48 2009 -0800

winhttp: Store hostname for secure connection in its SSL context.

---

 dlls/winhttp/net.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c
index 5d5f9b7..cf83f20 100644
--- a/dlls/winhttp/net.c
+++ b/dlls/winhttp/net.c
@@ -91,6 +91,7 @@ static void *libcrypto_handle;
 
 static SSL_METHOD *method;
 static SSL_CTX *ctx;
+static int hostname_idx;
 
 #define MAKE_FUNCPTR(f) static typeof(f) * p##f
 
@@ -106,6 +107,9 @@ MAKE_FUNCPTR( SSL_connect );
 MAKE_FUNCPTR( SSL_shutdown );
 MAKE_FUNCPTR( SSL_write );
 MAKE_FUNCPTR( SSL_read );
+MAKE_FUNCPTR( SSL_get_ex_new_index );
+MAKE_FUNCPTR( SSL_get_ex_data );
+MAKE_FUNCPTR( SSL_set_ex_data );
 MAKE_FUNCPTR( SSL_get_verify_result );
 MAKE_FUNCPTR( SSL_get_peer_certificate );
 MAKE_FUNCPTR( SSL_CTX_set_default_verify_paths );
@@ -254,6 +258,9 @@ BOOL netconn_init( netconn_t *conn, BOOL secure )
     LOAD_FUNCPTR( SSL_shutdown );
     LOAD_FUNCPTR( SSL_write );
     LOAD_FUNCPTR( SSL_read );
+    LOAD_FUNCPTR( SSL_get_ex_new_index );
+    LOAD_FUNCPTR( SSL_get_ex_data );
+    LOAD_FUNCPTR( SSL_set_ex_data );
     LOAD_FUNCPTR( SSL_get_verify_result );
     LOAD_FUNCPTR( SSL_get_peer_certificate );
     LOAD_FUNCPTR( SSL_CTX_set_default_verify_paths );
@@ -289,6 +296,7 @@ BOOL netconn_init( netconn_t *conn, BOOL secure )
         LeaveCriticalSection( &init_ssl_cs );
         return FALSE;
     }
+    hostname_idx = pSSL_get_ex_new_index( 0, (void *)"hostname index", NULL, NULL, NULL );
 
     pCRYPTO_set_id_callback(ssl_thread_id);
     num_ssl_locks = pCRYPTO_num_locks();
@@ -442,6 +450,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname )
         set_last_error( ERROR_WINHTTP_SECURE_CHANNEL_ERROR );
         goto fail;
     }
+    pSSL_set_ex_data( conn->ssl_conn, hostname_idx, hostname );
     if (!(cert = pSSL_get_peer_certificate( conn->ssl_conn )))
     {
         ERR("No certificate for server: %s\n", pERR_error_string( pERR_get_error(), 0 ));




More information about the wine-cvs mailing list