Hans Leidekker : winhttp: Ignore unknown schemes in WinHttpQueryAuthSchemes.
Alexandre Julliard
julliard at winehq.org
Thu Jul 20 12:11:28 CDT 2017
Module: wine
Branch: stable
Commit: 1d5367666efda268502ee597e14c5bf9383e91f8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1d5367666efda268502ee597e14c5bf9383e91f8
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Apr 6 09:38:12 2017 +0200
winhttp: Ignore unknown schemes in WinHttpQueryAuthSchemes.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 6b6ffb399a113a5125098671c1660e4c2c419d81)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/winhttp/request.c | 16 ++++++++++------
dlls/winhttp/tests/winhttp.c | 11 ++++++-----
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index b2b72c7..e3c0fb4 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -1315,7 +1315,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 (;;)
@@ -1336,15 +1336,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;
}
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 9777bd9..3818582 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -2521,7 +2521,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);
@@ -2540,11 +2540,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);
More information about the wine-cvs
mailing list