Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jan 2003 15:47:49 +0200
From:      Peter Pentchev <roam@ringlet.net>
To:        Ceri Davies <setantae@submonkey.net>
Cc:        Julian Mayer <julianmayer@mac.com>, knu@FreeBSD.org, ports@FreeBSD.org, Yar Tikhiy <yar@FreeBSD.org>, hackers@FreeBSD.org
Subject:   Re: FreeBSD Port: portupgrade-20021216
Message-ID:  <20030123134749.GA377@straylight.oblivion.bg>
In-Reply-To: <20030123101216.GA2856@submonkey.net>
References:  <F123A396-2E66-11D7-9D30-00039303B9CC@mac.com> <20030123081224.GA471@straylight.oblivion.bg> <20030123101216.GA2856@submonkey.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--v9Ux+11Zm5mwPlX6
Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C"
Content-Disposition: inline


--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jan 23, 2003 at 10:12:16AM +0000, Ceri Davies wrote:
[longish exchange preserved for the benefit of the newly-CC'd people:
 yar@ as a de-facto maintainer of libexec/ftpd, and -hackers for
 additional discussion]
> On Thu, Jan 23, 2003 at 10:12:24AM +0200, Peter Pentchev wrote:
> > On Thu, Jan 23, 2003 at 01:09:29AM +0100, Julian Mayer wrote:
> > > hello
> > > there is a bug in portupgrade-20021216: when you change the FTP port =
in=20
> > > /etc/services to run the FTP demon on another port, portupgrade is=20
> > > unable to download ports/packages via ftp
> > > is there a workaround?
> >=20
> > Errr.. this is not a bug in portupgrade, but the way most (all?) FTP
> > clients work.  If you change the port for the 'ftp' service, *any*
> > program that asks about the 'ftp' service will use the new port,
> > including all FTP clients that try to make outgoing connections.
>=20
> In that case, it sounds like a bug in our stock ftpd.
>=20
> DESCRIPTION
>      Ftpd is the Internet File Transfer Protocol server process.  The ser=
ver
>      uses the TCP protocol and listens at the port specified in the ``ftp=
''
>      service specification; see services(5).
>=20
> If this breaks outgoing ftp connections, then that's quite serious.
>=20
> > The appropriate way to "fix" that problem is to NOT change the port for
> > the 'ftp' service, but merely specify a different port on which to run
> > the FTP server.
>=20
> RTF ftpd(8) manual - there isn't any other (documented) way to do it.
>=20
> If I'm not missing something obvious, then I'll file a PR for this later.

Yes, it would seem that the stock ftpd does not provide a way to specify
a different port/service to use in daemon mode.  In inetd mode,
everything is fine and dandy.

Attached is a patch to the libexec/ftpd source, which adds a new -P
option taking an argument of either a numeric port number or a service
name as described in the getaddrinfo(3) manual page.  What do people
think about adding this functionality?

G'luck,
Peter

--=20
Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
The rest of this sentence is written in Thailand, on

--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=windows-1251
Content-Disposition: attachment; filename="libexec-ftpd.patch"
Content-Transfer-Encoding: quoted-printable

Index: src/libexec/ftpd/ftpd.8
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/libexec/ftpd/ftpd.8,v
retrieving revision 1.56
diff -u -r1.56 ftpd.8
--- src/libexec/ftpd/ftpd.8	27 Dec 2002 12:15:31 -0000	1.56
+++ src/libexec/ftpd/ftpd.8	23 Jan 2003 13:35:57 -0000
@@ -43,6 +43,7 @@
 .Op Fl 46ADdEMmOoRrSUvW
 .Op Fl l Op Fl l
 .Op Fl a Ar address
+.Op Fl P Ar port
 .Op Fl p Ar file
 .Op Fl T Ar maxtimeout
 .Op Fl t Ar timeout
@@ -133,6 +134,14 @@
 .It Fl o
 Put server in write-only mode.
 RETR is disabled, preventing downloads.
+.It Fl P
+When
+.Fl D
+is specified, accept connections on the specified
+.Ar port
+or service name instead of using the default
+.Nm ftp
+port.
 .It Fl p
 When
 .Fl D
Index: src/libexec/ftpd/ftpd.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.133
diff -u -r1.133 ftpd.c
--- src/libexec/ftpd/ftpd.c	21 Jan 2003 05:13:02 -0000	1.133
+++ src/libexec/ftpd/ftpd.c	23 Jan 2003 12:48:42 -0000
@@ -277,6 +277,7 @@
 	FILE *fd;
 	int error;
 	char	*bindname =3D NULL;
+	const char *bindport =3D "ftp";
 	int	family =3D AF_UNSPEC;
 	int	enable_v4 =3D 0;
 	struct sigaction sa;
@@ -296,7 +297,7 @@
 #endif /* OLD_SETPROCTITLE */
=20
=20
-	while ((ch =3D getopt(argc, argv, "46a:AdDElmMoOp:rRSt:T:u:UvW")) !=3D -1=
) {
+	while ((ch =3D getopt(argc, argv, "46a:AdDElmMoOp:P:rRSt:T:u:UvW")) !=3D =
-1) {
 		switch (ch) {
 		case '4':
 			enable_v4 =3D 1;
@@ -352,6 +353,10 @@
 			pid_file =3D optarg;
 			break;
=20
+		case 'P':
+			bindport =3D optarg;
+			break;
+
 		case 'r':
 			readonly =3D 1;
 			break;
@@ -436,11 +441,11 @@
 		hints.ai_socktype =3D SOCK_STREAM;
 		hints.ai_protocol =3D 0;
 		hints.ai_flags =3D AI_PASSIVE;
-		error =3D getaddrinfo(bindname, "ftp", &hints, &res);
+		error =3D getaddrinfo(bindname, bindport, &hints, &res);
 		if (error) {
 			if (family =3D=3D AF_UNSPEC) {
 				hints.ai_family =3D AF_UNSPEC;
-				error =3D getaddrinfo(bindname, "ftp", &hints,
+				error =3D getaddrinfo(bindname, bindport, &hints,
 						    &res);
 			}
 		}

--a8Wt8u1KmwUX3Y2C--

--v9Ux+11Zm5mwPlX6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+L/KF7Ri2jRYZRVMRAnjoAKC6dH9ZjYxYIaeiXittk5hXHnth/gCeIM3L
kNYfRbACZ4ljF3KKmHvIvGU=
=djhX
-----END PGP SIGNATURE-----

--v9Ux+11Zm5mwPlX6--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030123134749.GA377>