From kjm@ideon.st.ryukoku.ac.jp  Sun Feb 13 20:11:07 2000
Return-Path: <kjm@ideon.st.ryukoku.ac.jp>
Received: from rins.st.ryukoku.ac.jp (rins.st.ryukoku.ac.jp [133.83.4.1])
	by builder.freebsd.org (Postfix) with ESMTP id 73ECF3DB8
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 13 Feb 2000 20:11:00 -0800 (PST)
Received: from ideon.st.ryukoku.ac.jp (ideon.st.ryukoku.ac.jp [133.83.36.5])
	by rins.st.ryukoku.ac.jp (8.9.3+3.2W/3.7W/RINS-1.9.6-NOSPAM) with ESMTP id NAA10033
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 14 Feb 2000 13:11:00 +0900 (JST)
Received: (from kjm@localhost)
	by ideon.st.ryukoku.ac.jp (8.9.3/3.7W/kjm-19990628) id NAA73174;
	Mon, 14 Feb 2000 13:10:59 +0900 (JST)
Message-Id: <200002140410.NAA73174@ideon.st.ryukoku.ac.jp>
Date: Mon, 14 Feb 2000 13:10:59 +0900 (JST)
From: kjm@rins.ryukoku.ac.jp
Sender: kjm@ideon.st.ryukoku.ac.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: ftpd doesn't support -h option
X-Send-Pr-Version: 3.2

>Number:         16705
>Category:       bin
>Synopsis:       ftpd doesn't support -h option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 13 20:20:01 PST 2000
>Closed-Date:    Fri Feb 07 02:12:41 PST 2003
>Last-Modified:  Fri Feb 07 02:12:41 PST 2003
>Originator:     KOJIMA Hajime
>Release:        FreeBSD 3.4-RELEASE i386
>Organization:
Ryukoku University
>Environment:

	FreeBSD 3.4-RELEASE (x86)

>Description:

	telnetd support -h option (Disable the printing of
	host-specific information before login has been completed),
	but ftpd(8) doesn't.  

>How-To-Repeat:

	% man ftpd
...
SYNOPSIS
     ftpd [-d] [-l [-l]] [-A] [-D] [-R] [-S] [-U] [-T maxtimeout]
     [-t timeout] [-a address] [-p file]

>Fix:
	
    Apply this patch:

--- ftpd.c.dist	Mon Feb 14 12:19:01 2000
+++ ftpd.c	Mon Feb 14 12:55:01 2000
@@ -142,6 +142,7 @@
 int	mode;
 int	usedefault = 1;		/* for data transfers */
 int	pdata = -1;		/* for passive mode */
+int	hostinfo = 1;		/* do we print login banner? */
 sig_atomic_t transflag;
 off_t	file_size;
 off_t	byte_count;
@@ -287,7 +288,7 @@
 
 
 	bind_address.s_addr = htonl(INADDR_ANY);
-	while ((ch = getopt(argc, argv, "AdlDSURt:T:u:va:p:")) != -1) {
+	while ((ch = getopt(argc, argv, "AdlhDSURt:T:u:va:p:")) != -1) {
 		switch (ch) {
 		case 'D':
 			daemon_mode++;
@@ -353,6 +354,10 @@
 			debug = 1;
 			break;
 
+		case 'h':
+			hostinfo = 0;
+			break;
+
 		default:
 			warnx("unknown flag -%c ignored", optopt);
 			break;
@@ -546,7 +551,10 @@
 	(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, "Service ready.");
 	(void) setjmp(errcatch);
 	for (;;)
 		(void) yyparse();
@@ -1103,6 +1111,9 @@
 			syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s, %s",
 			    remotehost, passwd);
 	} else {
+	    if (!hostinfo)
+		lreply(230, "%s FTP server (%s) ready.", hostname, version);
+
 	    if (dochroot)
 		reply(230, "User %s logged in, access restrictions apply.", 
 			pw->pw_name);
--- ftpd.8.dist	Mon Feb 14 12:38:44 2000
+++ ftpd.8	Mon Feb 14 12:43:43 2000
@@ -43,6 +43,7 @@
 .Nm ftpd
 .Op Fl d
 .Op Fl l Op Fl l
+.Op Fl h
 .Op Fl A
 .Op Fl D
 .Op Fl R
@@ -80,6 +81,9 @@
 by default, and may have to be enabled in
 .Xr syslogd 8 Ns 's
 configuration file.
+.It Fl h
+Disable the printing of host-specific information before login
+has been completed.
 .It Fl D
 With this option set,
 .Nm

>Release-Note:
>Audit-Trail:

From: Jonathan Towne <jontow@twcny.rr.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc: kjm@rins.ryukoku.ac.jp
Subject: Re: bin/16705: ftpd doesn't support -h option
Date: Sun, 9 Jun 2002 11:45:10 -0400

 --tqI+Z3u+9OQ7kwn0
 Content-Type: text/plain; charset=us-ascii
 
 Good feature to have, and good point about telnetd including it, but
 ftpd not.. this patch applies cleanly to -CURRENT as of
 Sunday, June 9, ~10:30am EDT.
 
 - Jonathan Towne
 
 --tqI+Z3u+9OQ7kwn0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="ftpd.hinfo.fbsd5.patch"
 
 *** ftpd.c.orig	Tue May 28 14:55:04 2002
 --- ftpd.c	Sun Jun  9 11:36:05 2002
 ***************
 *** 139,144 ****
 --- 139,145 ----
   int	mode;
   int	usedefault = 1;		/* for data transfers */
   int	pdata = -1;		/* for passive mode */
 + int	hostinfo = 1;		/* do we print login banner? */
   int	readonly=0;		/* Server is in readonly mode.	*/
   int	noepsv=0;		/* EPSV command is disabled.	*/
   int	noretr=0;		/* RETR command is disabled.	*/
 ***************
 *** 297,303 ****
   #endif /* OLD_SETPROCTITLE */
   
   
 ! 	while ((ch = getopt(argc, argv, "AdlDESURrt:T:u:vOoa:p:46")) != -1) {
   		switch (ch) {
   		case 'D':
   			daemon_mode++;
 --- 298,304 ----
   #endif /* OLD_SETPROCTITLE */
   
   
 ! 	while ((ch = getopt(argc, argv, "AdlhDESURrt:T:u:vOoa:p:46")) != -1) {
   		switch (ch) {
   		case 'D':
   			daemon_mode++;
 ***************
 *** 388,393 ****
 --- 389,398 ----
   			noretr = 1;
   			break;
   
 + 		case 'h':
 + 			hostinfo = 0;
 + 			break;
 + 
   		default:
   			warnx("unknown flag -%c ignored", optopt);
   			break;
 ***************
 *** 620,626 ****
   	(void) gethostname(hostname, MAXHOSTNAMELEN - 1);
   	hostname[MAXHOSTNAMELEN - 1] = '\0';
   #endif
 ! 	reply(220, "%s FTP server (%s) ready.", hostname, version);
   	for (;;)
   		(void) yyparse();
   	/* NOTREACHED */
 --- 625,636 ----
   	(void) gethostname(hostname, MAXHOSTNAMELEN - 1);
   	hostname[MAXHOSTNAMELEN - 1] = '\0';
   #endif
 ! 
 ! 	if (hostinfo)
 ! 		reply(220, "%s FTP server (%s) ready.", hostname, version);
 ! 	else
 ! 		reply(220, "Service ready.");
 ! 
   	for (;;)
   		(void) yyparse();
   	/* NOTREACHED */
 ***************
 *** 1438,1443 ****
 --- 1448,1455 ----
   			syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s, %s",
   			    remotehost, passwd);
   	} else {
 + 		if (!hostinfo)
 + 			lreply(230, "%s FTP server (%s) ready.", hostname, version);
   		if (dochroot)
   			reply(230, "User %s logged in, "
   				   "access restrictions apply.", pw->pw_name);
 *** ftpd.8.orig	Mon Oct  1 08:58:03 2001
 --- ftpd.8	Sun Jun  9 11:32:23 2002
 ***************
 *** 42,47 ****
 --- 42,48 ----
   .Nm
   .Op Fl 46ADEORSUdro
   .Op Fl l Op Fl l
 + .Op Fl h
   .Op Fl T Ar maxtimeout
   .Op Fl a Ar address
   .Op Fl p Ar file
 ***************
 *** 149,154 ****
 --- 150,158 ----
   by default, and may have to be enabled in
   .Xr syslogd 8 Ns 's
   configuration file.
 + .It Fl h
 + Disable the printing of host-specific information before login
 + has been completed.
   .It Fl T
   A client may also request a different timeout period;
   the maximum period allowed may be set to
 
 --tqI+Z3u+9OQ7kwn0--

From: Yar Tikhiy <yar@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, kjm@rins.ryukoku.ac.jp,
	jontow@twcny.rr.com
Cc:  
Subject: Re: bin/16705: ftpd doesn't support -h option
Date: Tue, 30 Jul 2002 14:29:33 +0400

 I'd like to include this feature to ftpd, but with a single change:
 Why to print host-specific info at all in this case?  To my mind,
 it's better to omit it at all on the `-h' option, so paranoid admins
 can have a sound sleep :-)
 
 -- 
 Yar
Responsible-Changed-From-To: freebsd-bugs->yar 
Responsible-Changed-By: johan 
Responsible-Changed-When: Wed Aug 21 12:48:16 PDT 2002 
Responsible-Changed-Why:  
Over to Yar (new ftpd maintainer?) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=16705 
State-Changed-From-To: open->patched 
State-Changed-By: yar 
State-Changed-When: Wed Jan 29 02:59:24 PST 2003 
State-Changed-Why:  
Added the option "-h" to ftpd(8) in -current. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=16705 
State-Changed-From-To: patched->closed 
State-Changed-By: yar 
State-Changed-When: Fri Feb 7 02:12:13 PST 2003 
State-Changed-Why:  
Added this option to STABLE as well. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=16705 
>Unformatted:
