Added urlmon-ftp_escape patchset

This commit is contained in:
Alistair Leslie-Hughes 2019-01-29 11:03:45 +11:00
parent 1c5f409745
commit d2a48f1ad3
4 changed files with 147 additions and 0 deletions

View File

@ -304,6 +304,7 @@ patch_enable_all ()
enable_taskmgr_Memory_Usage="$1"
enable_ucrtbase__o_="$1"
enable_uianimation_stubs="$1"
enable_urlmon_ftp_escape="$1"
enable_user32_DM_SETDEFID="$1"
enable_user32_Dialog_Paint_Event="$1"
enable_user32_DrawMenuItem="$1"
@ -1076,6 +1077,9 @@ patch_enable ()
uianimation-stubs)
enable_uianimation_stubs="$2"
;;
urlmon-ftp_escape)
enable_urlmon_ftp_escape="$2"
;;
user32-DM_SETDEFID)
enable_user32_DM_SETDEFID="$2"
;;
@ -6386,6 +6390,23 @@ if test "$enable_uianimation_stubs" -eq 1; then
) >> "$patchlist"
fi
# Patchset urlmon-ftp_escape
# |
# | This patchset fixes the following Wine bugs:
# | * [#26445] urlmon: Use unescaped Urls for FTP actions
# |
# | Modified files:
# | * dlls/urlmon/ftp.c, dlls/urlmon/tests/Makefile.in, dlls/urlmon/tests/url.c
# |
if test "$enable_urlmon_ftp_escape" -eq 1; then
patch_apply urlmon-ftp_escape/0001-urlmon-Use-unescaped-Urls-for-FTP-actions.patch
patch_apply urlmon-ftp_escape/0002-urlmon-tests-Add-FTP-encoded-url-test.patch
(
printf '%s\n' '+ { "André Hentschel", "urlmon: Use unescaped Urls for FTP actions.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "urlmon/tests: Add FTP encoded url test.", 1 },';
) >> "$patchlist"
fi
# Patchset user32-DM_SETDEFID
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,44 @@
From 8900fa2361ec0fc9b22fd071a1c5d8cd5b7ffdbf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= <nerv@dawncrow.de>
Date: Tue, 29 Jan 2019 08:37:52 +1100
Subject: [PATCH] urlmon: Use unescaped Urls for FTP actions
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26445
---
dlls/urlmon/ftp.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/urlmon/ftp.c b/dlls/urlmon/ftp.c
index aef4a6c..b438d7c 100644
--- a/dlls/urlmon/ftp.c
+++ b/dlls/urlmon/ftp.c
@@ -66,17 +66,23 @@ static HRESULT FtpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request
HINTERNET internet_session, IInternetBindInfo *bind_info)
{
FtpProtocol *This = impl_from_Protocol(prot);
- BSTR url;
+ DWORD path_size = INTERNET_MAX_URL_LENGTH;
+ BSTR url, path;
HRESULT hres;
hres = IUri_GetAbsoluteUri(uri, &url);
if(FAILED(hres))
return hres;
+ path = heap_alloc(path_size);
+ hres = UrlUnescapeW((LPWSTR)url, path, &path_size, 0);
+ if(FAILED(hres))
+ return hres;
+ SysFreeString(url);
- This->base.request = InternetOpenUrlW(internet_session, url, NULL, 0,
+ This->base.request = InternetOpenUrlW(internet_session, path, NULL, 0,
request_flags|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_PASSIVE,
(DWORD_PTR)&This->base);
- SysFreeString(url);
+ SysFreeString(path);
if (!This->base.request && GetLastError() != ERROR_IO_PENDING) {
WARN("InternetOpenUrl failed: %d\n", GetLastError());
return INET_E_RESOURCE_NOT_FOUND;
--
1.9.1

View File

@ -0,0 +1,81 @@
From 70241b0a4b7eadff9b2baeced34186b59e3dc53a Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 29 Jan 2019 09:04:27 +1100
Subject: [PATCH] urlmon/tests: Add FTP encoded url test
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/urlmon/tests/Makefile.in | 2 +-
dlls/urlmon/tests/url.c | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/urlmon/tests/Makefile.in b/dlls/urlmon/tests/Makefile.in
index 2eef129..48afdc9 100644
--- a/dlls/urlmon/tests/Makefile.in
+++ b/dlls/urlmon/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = urlmon.dll
-IMPORTS = urlmon wininet ole32 oleaut32 user32 advapi32
+IMPORTS = urlmon wininet ole32 oleaut32 user32 advapi32 shlwapi
C_SRCS = \
generated.c \
diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c
index ada78c9..09e7d86 100644
--- a/dlls/urlmon/tests/url.c
+++ b/dlls/urlmon/tests/url.c
@@ -32,6 +32,7 @@
#include "urlmon.h"
#include "wininet.h"
#include "mshtml.h"
+#include "shlwapi.h"
#include "wine/test.h"
@@ -191,6 +192,7 @@ static BOOL async_switch = FALSE;
static BOOL strict_bsc_qi;
static DWORD bindtest_flags;
static const char *test_file;
+static const char *ftp_url;
static WCHAR file_url[INTERNET_MAX_URL_LENGTH], current_url[INTERNET_MAX_URL_LENGTH];
@@ -2905,7 +2907,10 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
url_a = (flags & BINDTEST_INVALID_CN) ? "https://4.15.184.77/favicon.ico" : "https://test.winehq.org/tests/hello.html";
break;
case FTP_TEST:
- url_a = "ftp://ftp.winehq.org/welcome.msg";
+ if(!ftp_url)
+ url_a = "ftp://ftp.winehq.org/welcome.msg";
+ else
+ url_a = ftp_url;
break;
default:
url_a = "winetest:test";
@@ -2969,6 +2974,13 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
if(FAILED(hres))
return;
+ if(protocol == FTP_TEST)
+ {
+ /* FTP url dont have any escape characters, so convert the url to what is expected */
+ DWORD size = 0;
+ UrlUnescapeW(current_url, NULL, &size, URL_UNESCAPE_INPLACE);
+ }
+
hres = IMoniker_QueryInterface(mon, &IID_IBinding, (void**)&bind);
ok(hres == E_NOINTERFACE, "IMoniker should not have IBinding interface\n");
if(SUCCEEDED(hres))
@@ -4144,6 +4156,9 @@ START_TEST(url)
trace("ftp test...\n");
test_BindToStorage(FTP_TEST, 0, TYMED_ISTREAM);
+ ftp_url = "ftp://ftp.winehq.org/welcome%2emsg";
+ test_BindToStorage(FTP_TEST, 0, TYMED_ISTREAM);
+
trace("test failures...\n");
test_BindToStorage_fail();
--
1.9.1

View File

@ -0,0 +1 @@
Fixes: [26445] urlmon: Use unescaped Urls for FTP actions