wget: fix ftp PASV mode ("numeric" check was too strict)

This commit is contained in:
Denis Vlasenko 2006-11-21 11:04:31 +00:00
parent 3e7ef7ead4
commit 40f62a8c3d

View File

@ -414,9 +414,11 @@ int wget_main(int argc, char **argv)
pasv_error:
bb_error_msg_and_die("bad response to %s: %s", "PASV", buf);
}
// Response is "227 garbageN1,N2,N3,N4,P1,P2
// Response is "227 garbageN1,N2,N3,N4,P1,P2[)]
// Server's IP is N1.N2.N3.N4 (we ignore it)
// Server's port for data connection is P1*256+P2
s = strrchr(buf, ')');
if (s && !s[1]) s[0] = '\0';
s = strrchr(buf, ',');
if (!s) goto pasv_error;
port = xatol_range(s+1, 0, 255);