From owner-freebsd-bugs@FreeBSD.ORG Mon Apr 7 11:50:18 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0EC9237B401 for ; Mon, 7 Apr 2003 11:50:18 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 21C1843F93 for ; Mon, 7 Apr 2003 11:50:16 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h37IoFUp058183 for ; Mon, 7 Apr 2003 11:50:15 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h37IoFQ5058182; Mon, 7 Apr 2003 11:50:15 -0700 (PDT) Resent-Date: Mon, 7 Apr 2003 11:50:15 -0700 (PDT) Resent-Message-Id: <200304071850.h37IoFQ5058182@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alex Semenyaka Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 40FFF37B401 for ; Mon, 7 Apr 2003 11:42:00 -0700 (PDT) Received: from snark.ratmir.ru (snark.ratmir.ru [213.24.248.177]) by mx1.FreeBSD.org (Postfix) with ESMTP id 00F7543FA3 for ; Mon, 7 Apr 2003 11:41:59 -0700 (PDT) (envelope-from freebsd@snark.ratmir.ru) Received: from snark.ratmir.ru (freebsd@localhost [127.0.0.1]) by snark.ratmir.ru (8.12.9/8.12.9) with ESMTP id h37IfvDR016084 for ; Mon, 7 Apr 2003 22:41:57 +0400 (MSD) (envelope-from freebsd@snark.ratmir.ru) Received: (from freebsd@localhost) by snark.ratmir.ru (8.12.9/8.12.9/Submit) id h37IfugY016083; Mon, 7 Apr 2003 22:41:56 +0400 (MSD) Message-Id: <200304071841.h37IfugY016083@snark.ratmir.ru> Date: Mon, 7 Apr 2003 22:41:56 +0400 (MSD) From: Alex Semenyaka To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/50690: ftpd -h does not work for the SYST command (patch included) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Alex Semenyaka List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2003 18:50:18 -0000 >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: