Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2ce16509
Commit
2ce16509
authored
Dec 16, 2014
by
Sebastian Lackner
Committed by
Alexandre Julliard
Jan 14, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Fix handling of subdirectory in FtpFindFirstFile.
Based on a patch by Mike Ruprecht.
parent
ea3ba293
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
3 deletions
+38
-3
ftp.c
dlls/wininet/ftp.c
+17
-1
ftp.c
dlls/wininet/tests/ftp.c
+21
-2
No files found.
dlls/wininet/ftp.c
View file @
2ce16509
...
...
@@ -831,6 +831,7 @@ static HINTERNET FTP_FtpFindFirstFileW(ftp_session_t *lpwfs,
INT
nResCode
;
appinfo_t
*
hIC
=
NULL
;
HINTERNET
hFindNext
=
NULL
;
LPWSTR
lpszSearchPath
=
NULL
;
TRACE
(
"
\n
"
);
...
...
@@ -846,7 +847,20 @@ static HINTERNET FTP_FtpFindFirstFileW(ftp_session_t *lpwfs,
if
(
!
FTP_SendPortOrPasv
(
lpwfs
))
goto
lend
;
if
(
!
FTP_SendCommand
(
lpwfs
->
sndSocket
,
FTP_CMD_LIST
,
NULL
,
/* split search path into file and path */
if
(
lpszSearchFile
)
{
LPCWSTR
name
=
lpszSearchFile
,
p
;
if
((
p
=
strrchrW
(
name
,
'\\'
)))
name
=
p
+
1
;
if
((
p
=
strrchrW
(
name
,
'/'
)))
name
=
p
+
1
;
if
(
name
!=
lpszSearchFile
)
{
lpszSearchPath
=
heap_strndupW
(
lpszSearchFile
,
name
-
lpszSearchFile
);
lpszSearchFile
=
name
;
}
}
if
(
!
FTP_SendCommand
(
lpwfs
->
sndSocket
,
FTP_CMD_LIST
,
lpszSearchPath
,
lpwfs
->
hdr
.
lpfnStatusCB
,
&
lpwfs
->
hdr
,
lpwfs
->
hdr
.
dwContext
))
goto
lend
;
...
...
@@ -872,6 +886,8 @@ static HINTERNET FTP_FtpFindFirstFileW(ftp_session_t *lpwfs,
}
lend:
heap_free
(
lpszSearchPath
);
if
(
lpwfs
->
lstnSocket
!=
-
1
)
{
closesocket
(
lpwfs
->
lstnSocket
);
...
...
dlls/wininet/tests/ftp.c
View file @
2ce16509
...
...
@@ -751,6 +751,7 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
HINTERNET
hSearch2
;
HINTERNET
hOpenFile
;
DWORD
error
;
BOOL
success
;
/* NULL as the search file ought to return the first file in the directory */
SetLastError
(
0xdeadbeef
);
...
...
@@ -770,13 +771,13 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
/* Try a valid filename in a subdirectory search */
SetLastError
(
0xdeadbeef
);
hSearch
=
FtpFindFirstFileA
(
hFtp
,
"pub/wine"
,
&
findData
,
0
,
0
);
todo_wine
ok
(
hSearch
!=
NULL
,
"Expected FtpFindFirstFileA to pass
\n
"
);
ok
(
hSearch
!=
NULL
,
"Expected FtpFindFirstFileA to pass
\n
"
);
InternetCloseHandle
(
hSearch
);
/* Try a valid filename in a subdirectory wildcard search */
SetLastError
(
0xdeadbeef
);
hSearch
=
FtpFindFirstFileA
(
hFtp
,
"pub/w*"
,
&
findData
,
0
,
0
);
todo_wine
ok
(
hSearch
!=
NULL
,
"Expected FtpFindFirstFileA to pass
\n
"
);
ok
(
hSearch
!=
NULL
,
"Expected FtpFindFirstFileA to pass
\n
"
);
InternetCloseHandle
(
hSearch
);
/* Try an invalid wildcard search */
...
...
@@ -785,6 +786,24 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
ok
(
hSearch
==
NULL
,
"Expected FtpFindFirstFileA to fail
\n
"
);
InternetCloseHandle
(
hSearch
);
/* Just in case */
/* change current directory, and repeat those tests - this shows
* that the search string is interpreted as relative directory. */
success
=
FtpSetCurrentDirectoryA
(
hFtp
,
"pub"
);
ok
(
success
,
"Expected FtpSetCurrentDirectory to succeed
\n
"
);
SetLastError
(
0xdeadbeef
);
hSearch
=
FtpFindFirstFileA
(
hFtp
,
"wine"
,
&
findData
,
0
,
0
);
ok
(
hSearch
!=
NULL
,
"Expected FtpFindFirstFileA to pass
\n
"
);
InternetCloseHandle
(
hSearch
);
SetLastError
(
0xdeadbeef
);
hSearch
=
FtpFindFirstFileA
(
hFtp
,
"w*"
,
&
findData
,
0
,
0
);
ok
(
hSearch
!=
NULL
,
"Expected FtpFindFirstFileA to pass
\n
"
);
InternetCloseHandle
(
hSearch
);
success
=
FtpSetCurrentDirectoryA
(
hFtp
,
".."
);
ok
(
success
,
"Expected FtpSetCurrentDirectory to succeed
\n
"
);
/* Try FindFirstFile between FtpOpenFile and InternetCloseHandle */
SetLastError
(
0xdeadbeef
);
hOpenFile
=
FtpOpenFileA
(
hFtp
,
"welcome.msg"
,
GENERIC_READ
,
FTP_TRANSFER_TYPE_ASCII
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment