Date: Mon, 7 Apr 2003 22:41:56 +0400 (MSD) From: Alex Semenyaka <alexs@snark.ratmir.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/50690: ftpd -h does not work for the SYST command (patch included) Message-ID: <200304071841.h37IfugY016083@snark.ratmir.ru> Resent-Message-ID: <200304071850.h37IoFQ5058182@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 50690 >Category: bin >Synopsis: ftpd -h does not work for the SYST command (patch included) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Apr 07 11:50:15 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Alex Semenyaka >Release: FreeBSD 4.8-RC i386 >Organization: Ratmir >Environment: System: FreeBSD snark.ratmir.ru 4.8-RC FreeBSD 4.8-RC #7: Sun Mar 30 07:23:48 MSD 2003 root@snark.ratmir.ru:/usr/obj/usr/src/sys/SNARK i386 Same problem exists also in the -CURRENT branch. >Description: When you run ftpd with the switch -h, which hould prevent obtaining the information about system you can still have such info with SYST command >How-To-Repeat: Tell to inetd to run ftpd with -h like this: ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l -h Then do telnet to the port 21, log in and issue SYST command: /tmp> telnet 0 21 Trying 0.0.0.0... Connected to 0. Escape character is '^]'. 220 FTP server ready. user ftp 331 Guest login ok, send your email address as password. pass a@ 230 Guest login ok, access restrictions apply. syst 215 UNIX Type: L8 Version: BSD-199506 quit 221 Goodbye. Connection closed by foreign host. >Fix: Here is the patch for -CURRENT. In the case when ftpd has been run with the -h switch the variable hostinfo is set to TRUE. In this case we should report only CHAR_BIT for our system and hide all other information as we do when this ftpd is built for the unknown platform: Index: ftpcmd.y =================================================================== RCS file: /usr/local/FreeBSD/src/libexec/ftpd/ftpcmd.y,v retrieving revision 1.50 diff -u -U1 -r1.50 ftpcmd.y --- ftpcmd.y 5 Feb 2003 11:11:32 -0000 1.50 +++ ftpcmd.y 5 Apr 2003 00:11:58 -0000 @@ -690,13 +690,17 @@ { - if ($2) + if ($2) { + if (hostinfo) #ifdef unix #ifdef BSD - reply(215, "UNIX Type: L%d Version: BSD-%d", - CHAR_BIT, BSD); + reply(215, "UNIX Type: L%d Version: BSD-%d", + CHAR_BIT, BSD); #else /* BSD */ - reply(215, "UNIX Type: L%d", CHAR_BIT); + reply(215, "UNIX Type: L%d", CHAR_BIT); #endif /* BSD */ #else /* unix */ - reply(215, "UNKNOWN Type: L%d", CHAR_BIT); + reply(215, "UNKNOWN Type: L%d", CHAR_BIT); #endif /* unix */ + else + reply(215, "UNKNOWN Type: L%d", CHAR_BIT); + } } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304071841.h37IfugY016083>