Daniel Lehman : wininet: Only accept proxy and proxy bypass if type is INTERNET_OPEN_TYPE_PROXY.
Alexandre Julliard
julliard at winehq.org
Wed May 8 15:48:21 CDT 2013
Module: wine
Branch: master
Commit: d3308e6f09245e905d02de55f352855b561e3d0a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d3308e6f09245e905d02de55f352855b561e3d0a
Author: Daniel Lehman <dlehman at esri.com>
Date: Mon May 6 09:52:37 2013 -0700
wininet: Only accept proxy and proxy bypass if type is INTERNET_OPEN_TYPE_PROXY.
---
dlls/wininet/internet.c | 10 ++++++++--
dlls/wininet/tests/http.c | 10 +++++++++-
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index b9f3e98..f8c36f7 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1015,6 +1015,11 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
/* Clear any error information */
INTERNET_SetLastError(0);
+ if((dwAccessType == INTERNET_OPEN_TYPE_PROXY) && !lpszProxy) {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
lpwai = alloc_object(NULL, &APPINFOVtbl, sizeof(appinfo_t));
if (!lpwai) {
SetLastError(ERROR_OUTOFMEMORY);
@@ -1031,9 +1036,10 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
lpwai->agent = heap_strdupW(lpszAgent);
if(dwAccessType == INTERNET_OPEN_TYPE_PRECONFIG)
INTERNET_ConfigureProxy( lpwai );
- else
+ else if(dwAccessType == INTERNET_OPEN_TYPE_PROXY) {
lpwai->proxy = heap_strdupW(lpszProxy);
- lpwai->proxyBypass = heap_strdupW(lpszProxyBypass);
+ lpwai->proxyBypass = heap_strdupW(lpszProxyBypass);
+ }
TRACE("returning %p\n", lpwai);
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 264aee7..bc3505f 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -2170,7 +2170,7 @@ out:
static void test_proxy_direct(int port)
{
HINTERNET hi, hc, hr;
- DWORD r, sz;
+ DWORD r, sz, error;
char buffer[0x40], *url;
WCHAR bufferW[0x40];
static CHAR username[] = "mike",
@@ -2181,6 +2181,14 @@ static void test_proxy_direct(int port)
passwordW[] = {'1','1','0','1',0},
useragentW[] = {'w','i','n','e','t','e','s','t',0};
+ /* specify proxy type without the proxy and bypass */
+ SetLastError(0xdeadbeef);
+ hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_PROXY, NULL, NULL, 0);
+ error = GetLastError();
+ ok(error == ERROR_INVALID_PARAMETER ||
+ broken(error == ERROR_SUCCESS) /* WinXPProSP2 */, "got %u\n", error);
+ ok(hi == NULL || broken(!!hi) /* WinXPProSP2 */, "open should have failed\n");
+
sprintf(buffer, "localhost:%d\n", port);
hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_PROXY, buffer, NULL, 0);
ok(hi != NULL, "open failed\n");
More information about the wine-cvs
mailing list