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:
Slava Zanko 2009-12-10 22:17:03 +02:00
parent 58b1609559
commit c0ebaf5bd3

View File

@ -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) {