[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] Active FTP Issue with Inetutils 1.5-4

From: Sergey Poznyakoff
Subject: Re: [bug-inetutils] Active FTP Issue with Inetutils 1.5-4
Date: Mon, 09 Mar 2009 13:37:13 +0200

Hi Curt,

> However I'm hoping you can help me with understanding why this seems
> to have changed.  We use to use 1.3-2 on our systems and that version
> did source from port 20.  That behavior has changed in 1.5 and is now
> sourcing from a high ordered port.  Do you know if this was done on
> purpose or if it's a bug?

Thanks for drawing my attention to this.  Indeed, ftpd.c as of version
1.3.2 explicitly set data source port to be control port - 1 (which
yielded 20 in most cases).  After analyzing our CVS history, I
discovered that this assignment disappeared on Jul 13, 2000.  The commit
on that day (see [1] for details) added the standalone daemon feature to
ftpd, and judging by the changeset, the loss of data source port
assignment was not intentional.  It seems rather to be some kind of
copy-n-paste error.

Since this was the historical ftpd behavior, I will restore it.  In the
meantime, please apply the attached patch and let me know if it works
for you.



Index: ftpd/ftpd.c
RCS file: /cvsroot/inetutils/inetutils/ftpd/ftpd.c,v
retrieving revision 1.64
diff -p -u -r1.64 ftpd.c
--- ftpd/ftpd.c 27 Dec 2008 20:35:56 -0000      1.64
+++ ftpd/ftpd.c 9 Mar 2009 11:34:09 -0000
@@ -1045,6 +1045,7 @@ getdatasock (const char *mode)
   /* anchor socket to avoid multi-homing problems */
   data_source.sin_family = AF_INET;
   data_source.sin_addr = ctrl_addr.sin_addr;
+  data_source.sin_port = htons (ntohs (ctrl_addr.sin_port) - 1);
   for (tries = 1;; tries++)
       if (bind (s, (struct sockaddr *) &data_source,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]