Commit 64728c61 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

wininet: Support option INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT for http requests.

parent 83ca4290
...@@ -2322,6 +2322,19 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe ...@@ -2322,6 +2322,19 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
*(ULONG*)buffer = hdr->ErrorMask; *(ULONG*)buffer = hdr->ErrorMask;
*size = sizeof(ULONG); *size = sizeof(ULONG);
return ERROR_SUCCESS; return ERROR_SUCCESS;
case INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT:
TRACE("INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT\n");
if (*size < sizeof(PCCERT_CHAIN_CONTEXT))
return ERROR_INSUFFICIENT_BUFFER;
if (!req->server->cert_chain)
return ERROR_INTERNET_INCORRECT_HANDLE_STATE;
*(PCCERT_CHAIN_CONTEXT *)buffer = CertDuplicateCertificateChain(req->server->cert_chain);
*size = sizeof(PCCERT_CHAIN_CONTEXT);
return ERROR_SUCCESS;
} }
return INET_QueryOption(hdr, option, buffer, size, unicode); return INET_QueryOption(hdr, option, buffer, size, unicode);
......
...@@ -6855,6 +6855,7 @@ static void test_secure_connection(void) ...@@ -6855,6 +6855,7 @@ static void test_secure_connection(void)
INTERNET_CERTIFICATE_INFOW *certificate_structW = NULL; INTERNET_CERTIFICATE_INFOW *certificate_structW = NULL;
char certstr1[512], certstr2[512]; char certstr1[512], certstr2[512];
BOOL ret; BOOL ret;
PCCERT_CHAIN_CONTEXT chain;
ses = InternetOpenA("Gizmo5", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); ses = InternetOpenA("Gizmo5", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
ok(ses != NULL, "InternetOpen failed\n"); ok(ses != NULL, "InternetOpen failed\n");
...@@ -6886,6 +6887,13 @@ static void test_secure_connection(void) ...@@ -6886,6 +6887,13 @@ static void test_secure_connection(void)
test_cert_struct(req, &test_winehq_org_cert); test_cert_struct(req, &test_winehq_org_cert);
size = sizeof(chain);
SetLastError(0xdeadbeef);
ret = InternetQueryOptionA(req, INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT, &chain, &size);
ok(ret || GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE /* < IE8 */,
"InternetQueryOption failed: %u\n", GetLastError());
if (ret) CertFreeCertificateChain(chain);
/* Querying the same option through InternetQueryOptionW still results in /* Querying the same option through InternetQueryOptionW still results in
* ANSI strings being returned. * ANSI strings being returned.
*/ */
...@@ -7825,6 +7833,7 @@ static void test_cert_string(void) ...@@ -7825,6 +7833,7 @@ static void test_cert_string(void)
char actual[512]; char actual[512];
DWORD size; DWORD size;
BOOL res; BOOL res;
PCCERT_CHAIN_CONTEXT chain;
ses = InternetOpenA( "winetest", 0, NULL, NULL, 0 ); ses = InternetOpenA( "winetest", 0, NULL, NULL, 0 );
ok( ses != NULL, "InternetOpenA failed\n" ); ok( ses != NULL, "InternetOpenA failed\n" );
...@@ -7845,6 +7854,12 @@ static void test_cert_string(void) ...@@ -7845,6 +7854,12 @@ static void test_cert_string(void)
ok( size == 0, "unexpected size: %u\n", size ); ok( size == 0, "unexpected size: %u\n", size );
ok( actual[0] == 0x55, "unexpected byte: %02x\n", actual[0] ); ok( actual[0] == 0x55, "unexpected byte: %02x\n", actual[0] );
size = sizeof(chain);
SetLastError(0xdeadbeef);
res = InternetQueryOptionA(req, INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT, &chain, &size);
ok(!res && (GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_STATE),
"InternetQueryOption failed: %u\n", GetLastError());
InternetCloseHandle( req ); InternetCloseHandle( req );
InternetCloseHandle( con ); InternetCloseHandle( con );
InternetCloseHandle( ses ); InternetCloseHandle( ses );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment