Add a new option to ftpd(8), "-h", to disable printing any
host-specific information in FTP server messages (so paranoid admins can sleep at night :-) PR: bin/16705 MFC after: 1 week
This commit is contained in:
parent
ce9287fc02
commit
c152df28e5
@ -75,6 +75,7 @@ static const char rcsid[] =
|
|||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
|
|
||||||
extern union sockunion data_dest, his_addr;
|
extern union sockunion data_dest, his_addr;
|
||||||
|
extern int hostinfo;
|
||||||
extern int logged_in;
|
extern int logged_in;
|
||||||
extern struct passwd *pw;
|
extern struct passwd *pw;
|
||||||
extern int guest;
|
extern int guest;
|
||||||
@ -1554,7 +1555,10 @@ help(struct tab *ctab, char *s)
|
|||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
}
|
}
|
||||||
(void) fflush(stdout);
|
(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;
|
return;
|
||||||
}
|
}
|
||||||
upper(s);
|
upper(s);
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
.Nd Internet File Transfer Protocol server
|
.Nd Internet File Transfer Protocol server
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl 46ADdEMmOoRrSUvW
|
.Op Fl 46ADdEhMmOoRrSUvW
|
||||||
.Op Fl l Op Fl l
|
.Op Fl l Op Fl l
|
||||||
.Op Fl a Ar address
|
.Op Fl a Ar address
|
||||||
.Op Fl P Ar port
|
.Op Fl P Ar port
|
||||||
@ -108,6 +108,9 @@ Debugging information is written to the syslog using
|
|||||||
.It Fl E
|
.It Fl E
|
||||||
Disable the EPSV command.
|
Disable the EPSV command.
|
||||||
This is useful for servers behind older firewalls.
|
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
|
.It Fl l
|
||||||
Each successful and failed
|
Each successful and failed
|
||||||
.Xr ftp 1
|
.Xr ftp 1
|
||||||
|
@ -116,6 +116,7 @@ union sockunion pasv_addr;
|
|||||||
int daemon_mode;
|
int daemon_mode;
|
||||||
int data;
|
int data;
|
||||||
int dataport;
|
int dataport;
|
||||||
|
int hostinfo = 1; /* print host-specific info in messages */
|
||||||
int logged_in;
|
int logged_in;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
char *homedir;
|
char *homedir;
|
||||||
@ -299,7 +300,8 @@ main(int argc, char *argv[], char **envp)
|
|||||||
#endif /* OLD_SETPROCTITLE */
|
#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) {
|
switch (ch) {
|
||||||
case '4':
|
case '4':
|
||||||
enable_v4 = 1;
|
enable_v4 = 1;
|
||||||
@ -331,6 +333,10 @@ main(int argc, char *argv[], char **envp)
|
|||||||
noepsv = 1;
|
noepsv = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
hostinfo = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
logging++; /* > 1 == extra logging */
|
logging++; /* > 1 == extra logging */
|
||||||
break;
|
break;
|
||||||
@ -638,7 +644,10 @@ main(int argc, char *argv[], char **envp)
|
|||||||
(void) gethostname(hostname, MAXHOSTNAMELEN - 1);
|
(void) gethostname(hostname, MAXHOSTNAMELEN - 1);
|
||||||
hostname[MAXHOSTNAMELEN - 1] = '\0';
|
hostname[MAXHOSTNAMELEN - 1] = '\0';
|
||||||
#endif
|
#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 (;;)
|
for (;;)
|
||||||
(void) yyparse();
|
(void) yyparse();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
@ -2228,8 +2237,11 @@ statcmd(void)
|
|||||||
char hname[NI_MAXHOST];
|
char hname[NI_MAXHOST];
|
||||||
int ispassive;
|
int ispassive;
|
||||||
|
|
||||||
lreply(211, "%s FTP server status:", hostname);
|
if (hostinfo) {
|
||||||
printf(" %s\r\n", version);
|
lreply(211, "%s FTP server status:", hostname);
|
||||||
|
printf(" %s\r\n", version);
|
||||||
|
} else
|
||||||
|
lreply(211, "FTP server status:");
|
||||||
printf(" Connected to %s", remotehost);
|
printf(" Connected to %s", remotehost);
|
||||||
if (!getnameinfo((struct sockaddr *)&his_addr, his_addr.su_len,
|
if (!getnameinfo((struct sockaddr *)&his_addr, his_addr.su_len,
|
||||||
hname, sizeof(hname) - 1, NULL, 0, NI_NUMERICHOST)) {
|
hname, sizeof(hname) - 1, NULL, 0, NI_NUMERICHOST)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user