Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/winhttp/session.c | 30 ++++++++++++++++++++++++++++-- dlls/winhttp/winhttp_private.h | 1 + 2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 82615ad12f..890894d1c0 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -611,6 +611,7 @@ static void request_destroy( struct object_header *hdr ) release_object( &request->connect->hdr );
CertFreeCertificateContext( request->server_cert ); + CertFreeCertificateContext( request->client_cert );
destroy_authinfo( request->authinfo ); destroy_authinfo( request->proxy_authinfo ); @@ -1000,14 +1001,39 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b return TRUE; } case WINHTTP_OPTION_CLIENT_CERT_CONTEXT: + { + const CERT_CONTEXT *cert; + if (!(hdr->flags & WINHTTP_FLAG_SECURE)) { SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_STATE ); return FALSE; } - FIXME("WINHTTP_OPTION_CLIENT_CERT_CONTEXT\n"); - return TRUE; + if (!buffer) + { + CertFreeCertificateContext( request->client_cert ); + request->client_cert = NULL; + } + else if (buflen >= sizeof(cert)) + { + if (!(cert = CertDuplicateCertificateContext( buffer ))) return FALSE; + CertFreeCertificateContext( request->client_cert ); + request->client_cert = cert; + } + else + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + }
+ if (request->cred_handle_initialized) + { + FreeCredentialsHandle( &request->cred_handle ); + request->cred_handle_initialized = FALSE; + } + + return TRUE; + } case WINHTTP_OPTION_ENABLE_FEATURE: if(buflen == sizeof( DWORD ) && *(DWORD *)buffer == WINHTTP_ENABLE_SSL_REVOCATION) { diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index b46f7087d8..33b96b97f0 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -182,6 +182,7 @@ struct request DWORD security_flags; BOOL check_revocation; const CERT_CONTEXT *server_cert; + const CERT_CONTEXT *client_cert; int resolve_timeout; int connect_timeout; int send_timeout;
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=46805
Your paranoid android.
=== debian9 (build log) ===
../../../wine/dlls/winhttp/session.c:1029:20: error: ‘struct request’ has no member named ‘cred_handle_initialized’ ../../../wine/dlls/winhttp/session.c:1031:44: error: ‘struct request’ has no member named ‘cred_handle’ ../../../wine/dlls/winhttp/session.c:1032:20: error: ‘struct request’ has no member named ‘cred_handle_initialized’ Makefile:358: recipe for target 'session.o' failed Makefile:8652: recipe for target 'dlls/winhttp' failed Task: The win32 build failed
=== debian9 (build log) ===
../../../wine/dlls/winhttp/session.c:1029:20: error: ‘struct request’ has no member named ‘cred_handle_initialized’ ../../../wine/dlls/winhttp/session.c:1031:44: error: ‘struct request’ has no member named ‘cred_handle’ ../../../wine/dlls/winhttp/session.c:1032:20: error: ‘struct request’ has no member named ‘cred_handle_initialized’ Makefile:357: recipe for target 'session.o' failed Makefile:8375: recipe for target 'dlls/winhttp' failed Task: The wow64 build failed