On Fri, May 24, 2002 at 09:08:34AM -0900, [EMAIL PROTECTED] wrote:
> I can confirm that 2.5.1 does not modify (correctly..) the IP contained
> within the reply from a PASV, before generating a PORT ww,xx,yy,zz,pp,pp
> statement to another server in establishing an fxp connection.
I have found the bug. Please test this patch.
--
Alexander.
Index: ftpclass.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/ftpclass.cc,v
retrieving revision 1.245
diff -u -p -r1.245 ftpclass.cc
--- ftpclass.cc 2002/05/07 13:20:35 1.245
+++ ftpclass.cc 2002/05/24 07:12:42
@@ -704,10 +704,11 @@ int Ftp::Handle_PASV()
if((a0==0 && a1==0 && a2==0 && a3==0)
|| (QueryBool("fix-pasv-address",hostname)
- && InPrivateNetwork(&data_sa) && !InPrivateNetwork(&peer_sa)))
+ && (InPrivateNetwork(&data_sa) != InPrivateNetwork(&peer_sa))))
{
// broken server, try to fix up
fixed_pasv=true;
+ DebugPrint("---- ","Address returned by PASV seemed to be incorrect and has
+been fixed",2);
if(data_sa.sa.sa_family==AF_INET)
memcpy(a,&peer_sa.in.sin_addr,sizeof(peer_sa.in.sin_addr));
#if INET6
@@ -1244,7 +1245,7 @@ int Ftp::Do()
goto usual_return;
addr_len=sizeof(peer_sa);
- getsockname(control_sock,&peer_sa.sa,&addr_len);
+ getpeername(control_sock,&peer_sa.sa,&addr_len);
#ifdef USE_SSL
if(proxy?!strncmp(proxy,"ftps://",7):ftps)