Bug#420940: apt-get can't enter passive mode
Package: apt
Version: 0.6.46.4-0.1
I have found apt-get can't enter passive mode when talking to some ftp
servers. The one that caused me trouble is ftp.icm.edu.pl which runs
wu-ftpd 2.6.2(1). The ftp method is prepared to parse a response to
PASV command where the numbers are enclosed in parentheses while
wu-ftpd sends the numbers without them.
I attach a patch which makes apt to cope with such a situation
gracefully.
--
Miłego dnia,
Łukasz Stelmach
--- apt-0.6.46.4.1/methods/ftp.cc 2006-12-04 15:37:36.000000000 +0100
+++ apt-0.6.46.4.1-new/methods/ftp.cc 2007-04-25 14:12:44.000000000 +0200
@@ -480,12 +480,21 @@ bool FTPConn::GoPasv()
// Unsupported function
string::size_type Pos = Msg.find('(');
- if (Tag >= 400 || Pos == string::npos)
+ if (Tag >= 400)
return true;
+
+ //wu-2.6.2(1) ftp server, returns
+ //227 Entering Passive Mode 193,219,28,140,150,111
+ //without parentheses, let's try to cope with it.
+ //wget(1) and ftp(1) can.
+ if (Pos == string::npos)
+ Pos = Msg.rfind(' ');
+ else
+ ++Pos;
// Scan it
unsigned a0,a1,a2,a3,p0,p1;
- if (sscanf(Msg.c_str() + Pos,"(%u,%u,%u,%u,%u,%u)",&a0,&a1,&a2,&a3,&p0,&p1) != 6)
+ if (sscanf(Msg.c_str() + Pos,"%u,%u,%u,%u,%u,%u",&a0,&a1,&a2,&a3,&p0,&p1) != 6)
return true;
/* Some evil servers return 0 to mean their addr. We can actually speak
Reply to: