[PATCH 1/2] urlmon: Use unescaped Urls for FTP actions
From: André Hentschel <nerv(a)dawncrow.de> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26445 Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> --- 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
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49715 Your paranoid android. === debian9 (32 bit report) === urlmon: protocol.c:1174: Test failed: unexpected call ReportResult protocol.c:1180: Test failed: hrResult = 800c0005, expected E_PENDING or S_OK protocol.c:3600: Test failed: Start failed: 800c0005 url.c:1878: Test failed: binding failed: 800c0005, expected 00000000 url.c:3086: Test failed: IMoniker_BindToStorage failed: 800c0005 === debian9 (32 bit Chinese:China report) === urlmon: protocol.c:1174: Test failed: unexpected call ReportResult protocol.c:1180: Test failed: hrResult = 800c0005, expected E_PENDING or S_OK protocol.c:3600: Test failed: Start failed: 800c0005 url.c:1878: Test failed: binding failed: 800c0005, expected 00000000 url.c:3086: Test failed: IMoniker_BindToStorage failed: 800c0005 === debian9b (32 bit WoW report) === urlmon: protocol.c:1174: Test failed: unexpected call ReportResult protocol.c:1180: Test failed: hrResult = 800c0005, expected E_PENDING or S_OK protocol.c:3600: Test failed: Start failed: 800c0005 url.c:1878: Test failed: binding failed: 800c0005, expected 00000000 url.c:3086: Test failed: IMoniker_BindToStorage failed: 800c0005 === debian9b (64 bit WoW report) === urlmon: protocol.c:1174: Test failed: unexpected call ReportResult protocol.c:1180: Test failed: hrResult = 800c0005, expected E_PENDING or S_OK protocol.c:3600: Test failed: Start failed: 800c0005 url.c:1878: Test failed: binding failed: 800c0005, expected 00000000 url.c:3086: Test failed: IMoniker_BindToStorage failed: 800c0005
Hi Alistair, On 3/22/19 5:50 AM, Alistair Leslie-Hughes wrote:
From: André Hentschel <nerv(a)dawncrow.de>
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26445 Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> --- 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);
We eliminated most of INTERNET_MAX_URL_LENGTH usages, let's not introduce new ones. In this case you could just unescape URL in place. Thanks, Jacek
participants (3)
-
Alistair Leslie-Hughes -
Jacek Caban -
Marvin