winhttp: Ignore unknown schemes in WinHttpQueryAuthSchemes.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Hans Leidekker 2017-04-06 09:38:12 +02:00 committed by Alexandre Julliard
parent 72d2715880
commit 6b6ffb399a
2 changed files with 16 additions and 11 deletions

View File

@ -1311,7 +1311,7 @@ static DWORD auth_scheme_from_header( WCHAR *header )
static BOOL query_auth_schemes( request_t *request, DWORD level, LPDWORD supported, LPDWORD first )
{
DWORD index = 0;
DWORD index = 0, supported_schemes = 0, first_scheme = 0;
BOOL ret = FALSE;
for (;;)
@ -1332,15 +1332,19 @@ static BOOL query_auth_schemes( request_t *request, DWORD level, LPDWORD support
}
scheme = auth_scheme_from_header( buffer );
heap_free( buffer );
if (!scheme) break;
if (!scheme) continue;
if (first && index == 1)
*first = *supported = scheme;
else
*supported |= scheme;
if (!first_scheme) first_scheme = scheme;
supported_schemes |= scheme;
ret = TRUE;
}
if (ret)
{
*supported = supported_schemes;
*first = first_scheme;
}
return ret;
}

View File

@ -2523,7 +2523,7 @@ static void test_multi_authentication(int port)
static const WCHAR multiauthW[] = {'/','m','u','l','t','i','a','u','t','h',0};
static const WCHAR getW[] = {'G','E','T',0};
HINTERNET ses, con, req;
DWORD supported = 10, first = 9, target = 8;
DWORD supported, first, target;
BOOL ret;
ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0);
@ -2542,11 +2542,12 @@ static void test_multi_authentication(int port)
ret = WinHttpReceiveResponse(req, NULL);
ok(ret, "expected success\n");
supported = first = target = 0xdeadbeef;
ret = WinHttpQueryAuthSchemes(req, &supported, &first, &target);
todo_wine ok(ret, "expected success\n");
todo_wine ok(supported == (WINHTTP_AUTH_SCHEME_BASIC | WINHTTP_AUTH_SCHEME_NTLM), "got %x\n", supported);
todo_wine ok(target == WINHTTP_AUTH_TARGET_SERVER, "got %x\n", target);
todo_wine ok(first == 1, "got %x\n", first);
ok(ret, "expected success\n");
ok(supported == (WINHTTP_AUTH_SCHEME_BASIC | WINHTTP_AUTH_SCHEME_NTLM), "got %x\n", supported);
ok(target == WINHTTP_AUTH_TARGET_SERVER, "got %x\n", target);
ok(first == WINHTTP_AUTH_SCHEME_BASIC, "got %x\n", first);
WinHttpCloseHandle(req);
WinHttpCloseHandle(con);