From owner-freebsd-bugs Sun May 19 13: 0:39 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id BF9C537B40A for ; Sun, 19 May 2002 13:00:12 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g4JK0Ck01016; Sun, 19 May 2002 13:00:12 -0700 (PDT) (envelope-from gnats) Received: from nwww.freebsd.org (www.FreeBSD.org [216.136.204.117]) by hub.freebsd.org (Postfix) with ESMTP id 81A4A37B409 for ; Sun, 19 May 2002 12:51:49 -0700 (PDT) Received: from www.freebsd.org (localhost [127.0.0.1]) by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g4JJpmhG054440 for ; Sun, 19 May 2002 12:51:48 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.2/8.12.2/Submit) id g4JJpmE9054439; Sun, 19 May 2002 12:51:48 -0700 (PDT) Message-Id: <200205191951.g4JJpmE9054439@www.freebsd.org> Date: Sun, 19 May 2002 12:51:48 -0700 (PDT) From: Woei-Luen@www.freebsd.org, Shyu To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/38303: tftpd -c patch Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 38303 >Category: bin >Synopsis: tftpd -c patch >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 19 13:00:12 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Woei-Luen, Shyu >Release: 4.6-PRERELEASE >Organization: National Chung-Cheng University >Environment: FreeBSD mail.dorm.ccu.edu.tw 4.6-PRERELEASE FreeBSD 4.6-PRERELEASE #0: Sun May 12 09:35:36 CST 2002 jonce@mail.dorm.ccu.edu.tw:/usr/obj/usr/src/sys/mail i386 >Description: According to the tftpd's manual page, the -c flag enables this feature: "If the directory does not exist, the client connection is refused." However, it does not work! After some hacking, I think there is a bug in the tftpd's source code and I make a patch for this bug. >How-To-Repeat: >Fix: --- tftpd.c Sun May 19 15:19:10 2002 +++ /usr/src/libexec/tftpd/tftpd.c Mon May 20 03:36:23 2002 @@ -256,9 +256,9 @@ NI_NUMERICHOST | NI_WITHSCOPEID); asprintf(&tempchroot, "%s/%s", chroot_dir, hbuf); statret = stat(tempchroot, &sb); - if ((sb.st_mode & S_IFDIR) && - (statret == 0 || (statret == -1 && ipchroot == 1))) - chroot_dir = tempchroot; + if ( ( statret == 0 && sb.st_mode & S_IFDIR ) || + ( ipchroot == 1 ) ) + chroot_dir = tempchroot; } /* Must get this before chroot because /etc might go away */ if ((nobody = getpwnam(chuser)) == NULL) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message