Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2001 03:08:58 +0100 (CET)
From:      bdluevel@heitec.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/25598: patch to let ftpd output message when changing directory
Message-ID:  <200103080208.f2828ww08461@ heitec.net>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103080208.f2828ww08461>