summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libexec/ftpd/ftpcmd.y6
-rw-r--r--libexec/ftpd/ftpd.85
-rw-r--r--libexec/ftpd/ftpd.c20
3 files changed, 25 insertions, 6 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index 261ffd0..b74c1fd 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -75,6 +75,7 @@ static const char rcsid[] =
#include "pathnames.h"
extern union sockunion data_dest, his_addr;
+extern int hostinfo;
extern int logged_in;
extern struct passwd *pw;
extern int guest;
@@ -1554,7 +1555,10 @@ help(struct tab *ctab, char *s)
printf("\r\n");
}
(void) fflush(stdout);
- reply(214, "Direct comments to ftp-bugs@%s.", hostname);
+ if (hostinfo)
+ reply(214, "Direct comments to ftp-bugs@%s.", hostname);
+ else
+ reply(214, "End.");
return;
}
upper(s);
diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8
index 491c177..5bf7c00 100644
--- a/libexec/ftpd/ftpd.8
+++ b/libexec/ftpd/ftpd.8
@@ -40,7 +40,7 @@
.Nd Internet File Transfer Protocol server
.Sh SYNOPSIS
.Nm
-.Op Fl 46ADdEMmOoRrSUvW
+.Op Fl 46ADdEhMmOoRrSUvW
.Op Fl l Op Fl l
.Op Fl a Ar address
.Op Fl P Ar port
@@ -108,6 +108,9 @@ Debugging information is written to the syslog using
.It Fl E
Disable the EPSV command.
This is useful for servers behind older firewalls.
+.It Fl h
+Disable printing host-specific information, such as the
+server software version or hostname, in server messages.
.It Fl l
Each successful and failed
.Xr ftp 1
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 3d60f42..bc96d2d 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -116,6 +116,7 @@ union sockunion pasv_addr;
int daemon_mode;
int data;
int dataport;
+int hostinfo = 1; /* print host-specific info in messages */
int logged_in;
struct passwd *pw;
char *homedir;
@@ -299,7 +300,8 @@ main(int argc, char *argv[], char **envp)
#endif /* OLD_SETPROCTITLE */
- while ((ch = getopt(argc, argv, "46a:AdDElmMoOp:P:rRSt:T:u:UvW")) != -1) {
+ while ((ch = getopt(argc, argv,
+ "46a:AdDEhlmMoOp:P:rRSt:T:u:UvW")) != -1) {
switch (ch) {
case '4':
enable_v4 = 1;
@@ -331,6 +333,10 @@ main(int argc, char *argv[], char **envp)
noepsv = 1;
break;
+ case 'h':
+ hostinfo = 0;
+ break;
+
case 'l':
logging++; /* > 1 == extra logging */
break;
@@ -638,7 +644,10 @@ main(int argc, char *argv[], char **envp)
(void) gethostname(hostname, MAXHOSTNAMELEN - 1);
hostname[MAXHOSTNAMELEN - 1] = '\0';
#endif
- reply(220, "%s FTP server (%s) ready.", hostname, version);
+ if (hostinfo)
+ reply(220, "%s FTP server (%s) ready.", hostname, version);
+ else
+ reply(220, "FTP server ready.");
for (;;)
(void) yyparse();
/* NOTREACHED */
@@ -2228,8 +2237,11 @@ statcmd(void)
char hname[NI_MAXHOST];
int ispassive;
- lreply(211, "%s FTP server status:", hostname);
- printf(" %s\r\n", version);
+ if (hostinfo) {
+ lreply(211, "%s FTP server status:", hostname);
+ printf(" %s\r\n", version);
+ } else
+ lreply(211, "FTP server status:");
printf(" Connected to %s", remotehost);
if (!getnameinfo((struct sockaddr *)&his_addr, his_addr.su_len,
hname, sizeof(hname) - 1, NULL, 0, NI_NUMERICHOST)) {
OpenPOWER on IntegriCloud