* add back support for `-h hostname'; it still may be useful to override

the name advertised to the client, even if ftpd can determine it from
  the ip address that ftpd is bound to. requested by mrg.
* remove -4/-6; they were effectively no-ops since itojun's change in 1.75.
* crank version
This commit is contained in:
lukem 1999-12-19 00:09:31 +00:00
parent 33f8460f90
commit 7543b77a8e
3 changed files with 36 additions and 35 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ftpd.8,v 1.47 1999/12/18 06:33:54 lukem Exp $ .\" $NetBSD: ftpd.8,v 1.48 1999/12/19 00:09:31 lukem Exp $
.\" .\"
.\" Copyright (c) 1997-1999 The NetBSD Foundation, Inc. .\" Copyright (c) 1997-1999 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -67,7 +67,7 @@
.\" .\"
.\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94 .\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94
.\" .\"
.Dd December 18, 1999 .Dd December 19, 1999
.Dt FTPD 8 .Dt FTPD 8
.Os .Os
.Sh NAME .Sh NAME
@ -80,6 +80,7 @@ Internet File Transfer Protocol server
.Op Fl a Ar anondir .Op Fl a Ar anondir
.Op Fl c Ar confdir .Op Fl c Ar confdir
.Op Fl C Ar user .Op Fl C Ar user
.Op Fl h Ar hostname
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
is the Internet File Transfer Protocol server process. is the Internet File Transfer Protocol server process.
@ -117,6 +118,22 @@ This can be useful for testing configurations.
.It Fl d .It Fl d
Debugging information is written to the syslog using Debugging information is written to the syslog using
.Dv LOG_FTP . .Dv LOG_FTP .
.It Fl h Ar hostname
Explicitly set the hostname to advertise as.
Defaults to the hostname associated with the IP address that
.NM
is listening on.
This ability (with or without
.Fl h ) ,
in conjunction with
.Fl c Ar confdir ,
is useful when configuring
.Sq virtual
.Tn FTP
servers, each listening on separate addresses as separate names.
Refer to
.Xr inetd.conf 5
for more information on starting services to listen on specific IP addresses.
.It Fl l .It Fl l
Each successful and failed Each successful and failed
.Tn FTP .Tn FTP
@ -475,21 +492,6 @@ to allow logging-in via
into the accounts, which must have into the accounts, which must have
.Pa /sbin/ftplogin .Pa /sbin/ftplogin
as login shell. as login shell.
.Sh Multiple virtual FTP servers
If
.Nm
is started on a specific IP address (with a separate IP name to the
system's hostname), then that separate name will be returned to the
client as the hostname that the client is connecting to.
This feature, in conjunction with
.Fl c Ar confdir ,
is useful when configuring
.Sq virtual
.Tn FTP
servers, each listening on separate addresses as separate names.
Refer to
.Xr inetd.conf 5
for more information on starting services to listen on specific IP addresses.
.Sh FILES .Sh FILES
.Bl -tag -width /etc/ftpwelcome -compact .Bl -tag -width /etc/ftpwelcome -compact
.It Pa /etc/ftpchroot .It Pa /etc/ftpchroot

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftpd.c,v 1.79 1999/12/18 06:33:54 lukem Exp $ */ /* $NetBSD: ftpd.c,v 1.80 1999/12/19 00:09:31 lukem Exp $ */
/* /*
* Copyright (c) 1997-1999 The NetBSD Foundation, Inc. * Copyright (c) 1997-1999 The NetBSD Foundation, Inc.
@ -109,7 +109,7 @@ __COPYRIGHT(
#if 0 #if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: ftpd.c,v 1.79 1999/12/18 06:33:54 lukem Exp $"); __RCSID("$NetBSD: ftpd.c,v 1.80 1999/12/19 00:09:31 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -191,7 +191,6 @@ int mode;
int doutmp = 0; /* update utmp file */ int doutmp = 0; /* update utmp file */
int usedefault = 1; /* for data transfers */ int usedefault = 1; /* for data transfers */
int pdata = -1; /* for passive mode */ int pdata = -1; /* for passive mode */
int family = AF_INET;
int mapped = 0; /* IPv4 connection on AF_INET6 socket */ int mapped = 0; /* IPv4 connection on AF_INET6 socket */
sig_atomic_t transflag; sig_atomic_t transflag;
off_t file_size; off_t file_size;
@ -278,8 +277,9 @@ main(argc, argv)
logging = 0; logging = 0;
sflag = 0; sflag = 0;
(void)strcpy(confdir, _DEFAULT_CONFDIR); (void)strcpy(confdir, _DEFAULT_CONFDIR);
hostname[0] = '\0';
while ((ch = getopt(argc, argv, "a:c:C:dlst:T:u:Uv46")) != -1) { while ((ch = getopt(argc, argv, "a:c:C:dh:lst:T:u:Uv")) != -1) {
switch (ch) { switch (ch) {
case 'a': case 'a':
anondir = optarg; anondir = optarg;
@ -298,6 +298,10 @@ main(argc, argv)
debug = 1; debug = 1;
break; break;
case 'h':
strlcpy(hostname, optarg, sizeof(hostname));
break;
case 'l': case 'l':
logging++; /* > 1 == extra logging */ logging++; /* > 1 == extra logging */
break; break;
@ -317,14 +321,6 @@ main(argc, argv)
doutmp = 1; doutmp = 1;
break; break;
case '4':
family = AF_INET;
break;
case '6':
family = AF_INET6;
break;
default: default:
if (optopt == 'a' || optopt == 'C') if (optopt == 'a' || optopt == 'C')
exit(1); exit(1);
@ -401,10 +397,13 @@ main(argc, argv)
#endif #endif
data_source.su_port = htons(ntohs(ctrl_addr.su_port) - 1); data_source.su_port = htons(ntohs(ctrl_addr.su_port) - 1);
if (getnameinfo((struct sockaddr *)&ctrl_addr, ctrl_addr.su_len, /* if the hostname hasn't been given, attempt to determine it */
hostname, sizeof(hostname), NULL, 0, 0) != 0) if (hostname[0] == '\0') {
(void)gethostname(hostname, sizeof(hostname)); if (getnameinfo((struct sockaddr *)&ctrl_addr, ctrl_addr.su_len,
hostname[sizeof(hostname) - 1] = '\0'; hostname, sizeof(hostname), NULL, 0, 0) != 0)
(void)gethostname(hostname, sizeof(hostname));
hostname[sizeof(hostname) - 1] = '\0';
}
/* set this here so klogin can use it... */ /* set this here so klogin can use it... */
(void)snprintf(ttyline, sizeof(ttyline), "ftp%d", getpid()); (void)snprintf(ttyline, sizeof(ttyline), "ftp%d", getpid());

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.1 1999/12/18 05:51:35 lukem Exp $ */ /* $NetBSD: version.h,v 1.2 1999/12/19 00:09:31 lukem Exp $ */
/*- /*-
* Copyright (c) 1999 The NetBSD Foundation, Inc. * Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -36,5 +36,5 @@
*/ */
#ifndef FTPD_VERSION #ifndef FTPD_VERSION
#define FTPD_VERSION "Version: NetBSD-ftpd/19991218" #define FTPD_VERSION "Version: NetBSD-ftpd/19991219"
#endif #endif