From owner-freebsd-bugs Wed Mar 7 18:10: 7 2001 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 BDFB537B719 for ; Wed, 7 Mar 2001 18:10:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f282A1d94740; Wed, 7 Mar 2001 18:10:01 -0800 (PST) (envelope-from gnats) Received: from christel.heitec.net (christel.heitec.net [193.101.232.3]) by hub.freebsd.org (Postfix) with ESMTP id 14B0537B719 for ; Wed, 7 Mar 2001 18:09:06 -0800 (PST) (envelope-from bernd@heitec.net) Received: from heitec.net (paladin.heitec.net [193.101.232.30]) by christel.heitec.net (Postfix) with ESMTP id 54EFAB8105 for ; Thu, 8 Mar 2001 03:08:59 +0100 (CET) Received: (from bernd@localhost) by heitec.net (8.11.3/8.11.3) id f2828ww08461; Thu, 8 Mar 2001 03:08:58 +0100 (CET) (envelope-from bernd) Message-Id: <200103080208.f2828ww08461@ heitec.net> Date: Thu, 8 Mar 2001 03:08:58 +0100 (CET) From: bdluevel@heitec.net Reply-To: bdluevel@heitec.net To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/25598: patch to let ftpd output message when changing directory Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 25598 >Category: bin >Synopsis: patch to let ftpd output message when changing directory >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Mar 07 18:10:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Bernd Luevelsmeyer >Release: FreeBSD 4.3-BETA i386 >Organization: >Environment: System: FreeBSD 4.3-BETA #0: Wed Mar 7 04:44:56 CET 2001 >Description: The patch lets the FTP daemon (after a successful 'cwd' command) look for a file '.message' in the current directory and, if readable, send the contents to the client, preceding the "250 CWD successful." message. The intent is to let the FTP site admin announce directory descriptions, copyright notices or the like. >How-To-Repeat: >Fix: --- libexec/ftpd/ftpd.c.orig Thu Mar 8 02:34:14 2001 +++ libexec/ftpd/ftpd.c Thu Mar 8 02:44:38 2001 @@ -2170,7 +2170,22 @@ if (chdir(path) < 0) perror_reply(550, path); else + { + char line[LINE_MAX]; + FILE *fd; + if ((fd = fopen(".message", "r")) != NULL) + { + while (fgets(line, sizeof(line), fd) != NULL) + { + char *cp; + if ((cp = strchr(line, '\n')) != NULL) + *cp = '\0'; + lreply(250, "%s", line); + } + fclose(fd); + } ack("CWD"); + } } void >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message