Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ftpd * add back support for `-h hostname'; it still ...
details: https://anonhg.NetBSD.org/src/rev/446f309bec57
branches: trunk
changeset: 479703:446f309bec57
user: lukem <lukem%NetBSD.org@localhost>
date: Sun Dec 19 00:09:31 1999 +0000
description:
* 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
diffstat:
libexec/ftpd/ftpd.8 | 36 +++++++++++++++++++-----------------
libexec/ftpd/ftpd.c | 31 +++++++++++++++----------------
libexec/ftpd/version.h | 4 ++--
3 files changed, 36 insertions(+), 35 deletions(-)
diffs (168 lines):
diff -r 40e477df0730 -r 446f309bec57 libexec/ftpd/ftpd.8
--- a/libexec/ftpd/ftpd.8 Sat Dec 18 23:22:54 1999 +0000
+++ b/libexec/ftpd/ftpd.8 Sun Dec 19 00:09:31 1999 +0000
@@ -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.
.\" All rights reserved.
@@ -67,7 +67,7 @@
.\"
.\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94
.\"
-.Dd December 18, 1999
+.Dd December 19, 1999
.Dt FTPD 8
.Os
.Sh NAME
@@ -80,6 +80,7 @@
.Op Fl a Ar anondir
.Op Fl c Ar confdir
.Op Fl C Ar user
+.Op Fl h Ar hostname
.Sh DESCRIPTION
.Nm
is the Internet File Transfer Protocol server process.
@@ -117,6 +118,22 @@
.It Fl d
Debugging information is written to the syslog using
.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
Each successful and failed
.Tn FTP
@@ -475,21 +492,6 @@
into the accounts, which must have
.Pa /sbin/ftplogin
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
.Bl -tag -width /etc/ftpwelcome -compact
.It Pa /etc/ftpchroot
diff -r 40e477df0730 -r 446f309bec57 libexec/ftpd/ftpd.c
--- a/libexec/ftpd/ftpd.c Sat Dec 18 23:22:54 1999 +0000
+++ b/libexec/ftpd/ftpd.c Sun Dec 19 00:09:31 1999 +0000
@@ -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.
@@ -109,7 +109,7 @@
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#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 /* not lint */
@@ -191,7 +191,6 @@
int doutmp = 0; /* update utmp file */
int usedefault = 1; /* for data transfers */
int pdata = -1; /* for passive mode */
-int family = AF_INET;
int mapped = 0; /* IPv4 connection on AF_INET6 socket */
sig_atomic_t transflag;
off_t file_size;
@@ -278,8 +277,9 @@
logging = 0;
sflag = 0;
(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) {
case 'a':
anondir = optarg;
@@ -298,6 +298,10 @@
debug = 1;
break;
+ case 'h':
+ strlcpy(hostname, optarg, sizeof(hostname));
+ break;
+
case 'l':
logging++; /* > 1 == extra logging */
break;
@@ -317,14 +321,6 @@
doutmp = 1;
break;
- case '4':
- family = AF_INET;
- break;
-
- case '6':
- family = AF_INET6;
- break;
-
default:
if (optopt == 'a' || optopt == 'C')
exit(1);
@@ -401,10 +397,13 @@
#endif
data_source.su_port = htons(ntohs(ctrl_addr.su_port) - 1);
- if (getnameinfo((struct sockaddr *)&ctrl_addr, ctrl_addr.su_len,
- hostname, sizeof(hostname), NULL, 0, 0) != 0)
- (void)gethostname(hostname, sizeof(hostname));
- hostname[sizeof(hostname) - 1] = '\0';
+ /* if the hostname hasn't been given, attempt to determine it */
+ if (hostname[0] == '\0') {
+ if (getnameinfo((struct sockaddr *)&ctrl_addr, ctrl_addr.su_len,
+ 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... */
(void)snprintf(ttyline, sizeof(ttyline), "ftp%d", getpid());
diff -r 40e477df0730 -r 446f309bec57 libexec/ftpd/version.h
--- a/libexec/ftpd/version.h Sat Dec 18 23:22:54 1999 +0000
+++ b/libexec/ftpd/version.h Sun Dec 19 00:09:31 1999 +0000
@@ -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.
* All rights reserved.
@@ -36,5 +36,5 @@
*/
#ifndef FTPD_VERSION
-#define FTPD_VERSION "Version: NetBSD-ftpd/19991218"
+#define FTPD_VERSION "Version: NetBSD-ftpd/19991219"
#endif
Home |
Main Index |
Thread Index |
Old Index