mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +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;
|
||||
socklen_t data_addrlen;
|
||||
int data_sock;
|
||||
int data_sock, result;
|
||||
|
||||
again:
|
||||
memset (&data_addr, 0, 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;
|
||||
|
||||
switch (data_addr.ss_family) {
|
||||
|
Loading…
Reference in New Issue
Block a user