[BusyBox] wget: error msg with Meteor ftp server

Jörg Albert JAlbert at advaoptical.de
Wed Nov 12 08:13:39 UTC 2003


Hi all,

I use to get the error msg
	fgets(): Illegal seek
at the end of an otherwise successfull "wget ftp://..." call
when connecting to a Meteor 1.5 ftp server under Windows while
a connect to vsftpd under RedHat9 is fine.

The error comes from fgets() in ftpcmd(), which waits for an answer for each
command sent.

A sniffer revealed that Meteor does not answer to the final QUIT
but simply closes its socket (which is the behaviour described in RFC959,
chapter 7), while vsftpd says "Goodbye."

A possible workaround (for wget.c, 1.61, not tested with with this version!)
could be:

--- wget_bb_cvs_1.61.c.orig	2003-11-12 08:59:56.000000000 +0100
+++ wget_bb_cvs_1.61.c	2003-11-12 09:02:08.000000000 +0100
@@ -674,8 +674,14 @@
 	
 	do {
 		p = fgets(buf, 510, fp);
-		if (!p)
-			bb_perror_msg_and_die("fgets()");
+		if (!p) {
+			/* jal: Meteor ftp closes the connection immediately
+			   after receiving QUIT (no reply) */
+			if (strncmp(s1,"QUIT",4))
+				bb_perror_msg_and_die("fgets()");
+			else
+			    strcpy(buf, "221 Goodbye (faked).");
+		}
 	} while (! isdigit(buf[0]) || buf[3] != ' ');
 	
 	return atoi(buf);

althrough I'm not really happy with this hack. The "big" wget, version 1.9,
doesn't send QUIT, but simply closes it's socket...

Any other ideas?

/Jörg 



More information about the busybox mailing list