diff options
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ftpd/ftpd.8 | 24 | ||||
-rw-r--r-- | libexec/ftpd/ftpd.c | 21 |
2 files changed, 18 insertions, 27 deletions
diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8 index 58679d0c7f3..6de1b26327d 100644 --- a/libexec/ftpd/ftpd.8 +++ b/libexec/ftpd/ftpd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ftpd.8,v 1.50 2002/03/27 18:10:37 millert Exp $ +.\" $OpenBSD: ftpd.8,v 1.51 2002/07/14 07:14:09 jakob Exp $ .\" $NetBSD: ftpd.8,v 1.8 1996/01/14 20:55:23 thorpej Exp $ .\" .\" Copyright (c) 1985, 1988, 1991, 1993 @@ -42,7 +42,7 @@ .Nd Internet File Transfer Protocol server .Sh SYNOPSIS .Nm ftpd -.Op Fl AdDhlMPSU46 +.Op Fl AdDlMPSU46 .Op Fl T Ar maxtimeout .Op Fl t Ar timeout .Op Fl u Ar mask @@ -78,16 +78,6 @@ This has lower overhead than starting from .Xr inetd 8 and is thus useful on busy servers to reduce load. -.It Fl h -The server will use data ports in the high port range for passive connections. -This range is defined by the -.Ev IPPORT_HIFIRSTAUTO -and -.Ev IPPORT_HILASTAUTO -defines in <netinet/in.h>. -In -.Ox -they are set to 49152 and 65535 respectively. .It Fl l Each successful and failed .Xr ftp 1 @@ -497,6 +487,16 @@ If this variable is not set, .Pa /etc/motd is used. .El +.Sh PORT ALLOCATION +For passive mode data connections, +.Nm +will listen to a random high tcp port. +The interval of ports used are configurable using +.Xr sysctl 8 +variables +.Li net.inet.ip.porthifirst +and +.Li net.inet.ip.porthilast . .Sh FILES .Bl -tag -width /var/run/ftpd.pid -compact .It Pa /etc/ftpchroot diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 747c77bf9e8..e74352b2aa3 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.130 2002/07/02 18:09:54 danh Exp $ */ +/* $OpenBSD: ftpd.c,v 1.131 2002/07/14 07:14:09 jakob Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -74,7 +74,7 @@ static const char copyright[] = static const char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; #else static const char rcsid[] = - "$OpenBSD: ftpd.c,v 1.130 2002/07/02 18:09:54 danh Exp $"; + "$OpenBSD: ftpd.c,v 1.131 2002/07/14 07:14:09 jakob Exp $"; #endif #endif /* not lint */ @@ -150,7 +150,6 @@ int debug = 0; int timeout = 900; /* timeout after 15 minutes of inactivity */ int maxtimeout = 7200;/* don't allow idle time to be set beyond 2 hours */ int logging; -int high_data_ports = 0; int anon_only = 0; int multihome = 0; int guest; @@ -317,8 +316,7 @@ main(argc, argv, envp) portcheck = 0; break; - case 'h': - high_data_ports = 1; + case 'h': /* deprecated */ break; case 'l': @@ -2219,12 +2217,10 @@ passive() return; } -#ifdef IP_PORTRANGE - on = high_data_ports ? IP_PORTRANGE_HIGH : IP_PORTRANGE_DEFAULT; + on = IP_PORTRANGE_HIGH; if (setsockopt(pdata, IPPROTO_IP, IP_PORTRANGE, (char *)&on, sizeof(on)) < 0) goto pasv_error; -#endif pasv_addr = ctrl_addr; pasv_addr.su_sin.sin_port = 0; @@ -2356,21 +2352,16 @@ long_passive(char *cmd, int pf) switch (ctrl_addr.su_family) { case AF_INET: -#ifdef IP_PORTRANGE - on = high_data_ports ? IP_PORTRANGE_HIGH : IP_PORTRANGE_DEFAULT; + on = IP_PORTRANGE_HIGH; if (setsockopt(pdata, IPPROTO_IP, IP_PORTRANGE, (char *)&on, sizeof(on)) < 0) goto pasv_error; -#endif break; case AF_INET6: -#ifdef IPV6_PORTRANGE - on = high_data_ports ? IPV6_PORTRANGE_HIGH - : IPV6_PORTRANGE_DEFAULT; + on = IPV6_PORTRANGE_HIGH; if (setsockopt(pdata, IPPROTO_IPV6, IPV6_PORTRANGE, (char *)&on, sizeof(on)) < 0) goto pasv_error; -#endif break; } |