Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
9a442f73
Commit
9a442f73
authored
Nov 07, 2000
by
Huw D M Davies
Committed by
Alexandre Julliard
Nov 07, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send the local ip address with the PORT command and not that of the
server. Fix handling of multi-line responses. Read a response after the STOR command.
parent
d41c9a3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
14 deletions
+48
-14
ftp.c
dlls/wininet/ftp.c
+48
-14
No files found.
dlls/wininet/ftp.c
View file @
9a442f73
...
...
@@ -20,6 +20,7 @@
#endif
#include <sys/stat.h>
#include <unistd.h>
#include <netinet/ip.h>
#include "winbase.h"
#include "wingdi.h"
...
...
@@ -167,6 +168,7 @@ BOOL WINAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
BOOL
bSuccess
=
FALSE
;
LPWININETAPPINFOA
hIC
=
NULL
;
LPWININETFTPSESSIONA
lpwfs
=
(
LPWININETFTPSESSIONA
)
hConnect
;
INT
nResCode
;
TRACE
(
" lpszLocalFile(%s) lpszNewRemoteFile(%s)
\n
"
,
lpszLocalFile
,
lpszNewRemoteFile
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
...
...
@@ -198,8 +200,16 @@ BOOL WINAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
if
(
FTP_InitDataSocket
(
lpwfs
,
&
nDataSocket
))
{
FTP_SendData
(
lpwfs
,
nDataSocket
,
hFile
);
bSuccess
=
TRUE
;
close
(
nDataSocket
);
nResCode
=
FTP_ReceiveResponse
(
lpwfs
->
sndSocket
,
INTERNET_GetResponseBuffer
(),
MAX_REPLY_LEN
,
0
,
0
,
0
);
if
(
nResCode
)
{
if
(
nResCode
==
226
)
bSuccess
=
TRUE
;
else
FTP_SetResponseError
(
nResCode
);
}
}
}
...
...
@@ -1234,7 +1244,7 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
{
struct
sockaddr_in
socketAddr
;
struct
hostent
*
phe
=
NULL
;
INT
nsocket
=
INVALID_SOCKET
;
INT
nsocket
=
INVALID_SOCKET
,
sock_namelen
;
LPWININETAPPINFOA
hIC
=
NULL
;
BOOL
bSuccess
=
FALSE
;
LPWININETFTPSESSIONA
lpwfs
=
NULL
;
...
...
@@ -1305,7 +1315,8 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
lpwfs
->
hdr
.
dwContext
=
dwContext
;
lpwfs
->
hdr
.
lpwhparent
=
(
LPWININETHANDLEHEADER
)
hInternet
;
lpwfs
->
sndSocket
=
nsocket
;
memcpy
(
&
lpwfs
->
socketAddress
,
&
socketAddr
,
sizeof
(
socketAddr
));
sock_namelen
=
sizeof
(
lpwfs
->
socketAddress
);
getsockname
(
nsocket
,
&
lpwfs
->
socketAddress
,
&
sock_namelen
);
lpwfs
->
phostent
=
phe
;
if
(
NULL
==
lpszUserName
)
...
...
@@ -1473,6 +1484,9 @@ INT FTP_ReceiveResponse(INT nSocket, LPSTR lpszResponse, DWORD dwResponse,
{
DWORD
nRecv
;
INT
rc
=
0
;
char
firstprefix
[
5
];
BOOL
multiline
=
FALSE
;
TRACE
(
"socket(%d)
\n
"
,
nSocket
);
...
...
@@ -1485,8 +1499,26 @@ INT FTP_ReceiveResponse(INT nSocket, LPSTR lpszResponse, DWORD dwResponse,
if
(
!
INTERNET_GetNextLine
(
nSocket
,
lpszResponse
,
&
nRecv
))
goto
lerror
;
if
(
nRecv
>=
3
&&
lpszResponse
[
3
]
!=
'-'
)
break
;
if
(
nRecv
>=
3
)
{
if
(
!
multiline
)
{
if
(
lpszResponse
[
3
]
!=
'-'
)
break
;
else
{
/* Start of multiline repsonse. Loop until we get "nnn " */
multiline
=
TRUE
;
memcpy
(
firstprefix
,
lpszResponse
,
3
);
firstprefix
[
3
]
=
' '
;
firstprefix
[
4
]
=
'\0'
;
}
}
else
{
if
(
!
memcmp
(
firstprefix
,
lpszResponse
,
4
))
break
;
}
}
}
if
(
nRecv
>=
3
)
...
...
@@ -1649,9 +1681,12 @@ BOOL FTP_InitListenSocket(LPWININETFTPSESSIONA lpwfs)
goto
lend
;
}
lpwfs
->
lstnSocketAddress
.
sin_family
=
AF_INET
;
/* We obtain our ip addr from the name of the command channel socket */
lpwfs
->
lstnSocketAddress
=
lpwfs
->
socketAddress
;
/* and get the system to assign us a port */
lpwfs
->
lstnSocketAddress
.
sin_port
=
htons
((
u_short
)
0
);
lpwfs
->
lstnSocketAddress
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
SOCKET_ERROR
==
bind
(
lpwfs
->
lstnSocket
,(
struct
sockaddr
*
)
&
lpwfs
->
lstnSocketAddress
,
sizeof
(
struct
sockaddr_in
)))
{
TRACE
(
"Unable to bind socket
\n
"
);
...
...
@@ -1731,14 +1766,13 @@ BOOL FTP_SendPort(LPWININETFTPSESSIONA lpwfs)
INT
nResCode
;
CHAR
szIPAddress
[
64
];
BOOL
bSuccess
=
FALSE
;
TRACE
(
"
\n
"
);
sprintf
(
szIPAddress
,
"%d,%d,%d,%d,%d,%d"
,
lpwfs
->
s
ocketAddress
.
sin_addr
.
s_addr
&
0x000000FF
,
(
lpwfs
->
s
ocketAddress
.
sin_addr
.
s_addr
&
0x0000FF00
)
>>
8
,
(
lpwfs
->
s
ocketAddress
.
sin_addr
.
s_addr
&
0x00FF0000
)
>>
16
,
(
lpwfs
->
s
ocketAddress
.
sin_addr
.
s_addr
&
0xFF000000
)
>>
24
,
lpwfs
->
lstnS
ocketAddress
.
sin_addr
.
s_addr
&
0x000000FF
,
(
lpwfs
->
lstnS
ocketAddress
.
sin_addr
.
s_addr
&
0x0000FF00
)
>>
8
,
(
lpwfs
->
lstnS
ocketAddress
.
sin_addr
.
s_addr
&
0x00FF0000
)
>>
16
,
(
lpwfs
->
lstnS
ocketAddress
.
sin_addr
.
s_addr
&
0xFF000000
)
>>
24
,
lpwfs
->
lstnSocketAddress
.
sin_port
&
0xFF
,
(
lpwfs
->
lstnSocketAddress
.
sin_port
&
0xFF00
)
>>
8
);
...
...
@@ -1845,13 +1879,13 @@ BOOL FTP_SendData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, HANDLE hFile)
nSeconds
=
e_long_time
-
s_long_time
;
if
(
nSeconds
/
60
>
0
)
{
TRACE
(
"%ld bytes of %d bytes (%ld%%) in %ld min %ld sec estimated remainig time %ld sec
\
t\t\r
"
,
TRACE
(
"%ld bytes of %d bytes (%ld%%) in %ld min %ld sec estimated remainig time %ld sec
\
n
"
,
nTotalSent
,
fi
.
nFileSizeLow
,
nTotalSent
*
100
/
fi
.
nFileSizeLow
,
nSeconds
/
60
,
nSeconds
%
60
,
(
fi
.
nFileSizeLow
-
nTotalSent
)
*
nSeconds
/
nTotalSent
);
}
else
{
TRACE
(
"%ld bytes of %d bytes (%ld%%) in %ld sec estimated remainig time %ld sec
\
t\t\r
"
,
TRACE
(
"%ld bytes of %d bytes (%ld%%) in %ld sec estimated remainig time %ld sec
\
n
"
,
nTotalSent
,
fi
.
nFileSizeLow
,
nTotalSent
*
100
/
fi
.
nFileSizeLow
,
nSeconds
,
(
fi
.
nFileSizeLow
-
nTotalSent
)
*
nSeconds
/
nTotalSent
);
}
...
...
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