mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Ticket #1796: FTPFS does not work in active mode.
Fix commit for work in passive ftp-mode. Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
58b1609559
commit
c0ebaf5bd3
@ -976,13 +976,18 @@ ftpfs_initconn (struct vfs_class *me, struct vfs_s_super *super)
|
|||||||
{
|
{
|
||||||
struct sockaddr_storage data_addr;
|
struct sockaddr_storage data_addr;
|
||||||
socklen_t data_addrlen;
|
socklen_t data_addrlen;
|
||||||
int data_sock;
|
int data_sock, result;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
memset (&data_addr, 0, sizeof (struct sockaddr_storage));
|
memset (&data_addr, 0, sizeof (struct sockaddr_storage));
|
||||||
data_addrlen = sizeof (struct sockaddr_storage);
|
data_addrlen = sizeof (struct sockaddr_storage);
|
||||||
|
|
||||||
if (getsockname (SUP.sock, (struct sockaddr *) &data_addr, &data_addrlen) == -1)
|
if (SUP.use_passive_connection)
|
||||||
|
result = getpeername (SUP.sock, (struct sockaddr *) &data_addr, &data_addrlen);
|
||||||
|
else
|
||||||
|
result = getsockname (SUP.sock, (struct sockaddr *) &data_addr, &data_addrlen);
|
||||||
|
|
||||||
|
if (result == -1 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
switch (data_addr.ss_family) {
|
switch (data_addr.ss_family) {
|
||||||
|
Loading…
Reference in New Issue
Block a user