svn commit: trunk/busybox/networking

vda at busybox.net vda at busybox.net
Tue Nov 21 11:04:31 UTC 2006


Author: vda
Date: 2006-11-21 03:04:31 -0800 (Tue, 21 Nov 2006)
New Revision: 16603

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


Modified:
   trunk/busybox/networking/wget.c


Changeset:
Modified: trunk/busybox/networking/wget.c
===================================================================
--- trunk/busybox/networking/wget.c	2006-11-21 10:53:05 UTC (rev 16602)
+++ trunk/busybox/networking/wget.c	2006-11-21 11:04:31 UTC (rev 16603)
@@ -414,9 +414,11 @@
  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);
@@ -608,13 +610,13 @@
 		return NULL;
 
 	/* see if we are at the end of the headers */
-	for (s = buf ; *s == '\r' ; ++s)
+	for (s = buf; *s == '\r'; ++s)
 		;
 	if (s[0] == '\n')
 		return NULL;
 
 	/* convert the header name to lower case */
-	for (s = buf ; isalnum(*s) || *s == '-' ; ++s)
+	for (s = buf; isalnum(*s) || *s == '-'; ++s)
 		*s = tolower(*s);
 
 	/* verify we are at the end of the header name */
@@ -622,7 +624,7 @@
 		bb_error_msg_and_die("bad header line: %s", buf);
 
 	/* locate the start of the header value */
-	for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s)
+	for (*s++ = '\0'; *s == ' ' || *s == '\t'; ++s)
 		;
 	hdrval = s;
 




More information about the busybox-cvs mailing list