From d64f699be3115988fcced7233b48fe12446e1260 Mon Sep 17 00:00:00 2001 From: millert Date: Tue, 25 Mar 1997 22:47:08 +0000 Subject: [PATCH] Splat .message file if it exists when user cd's to a directory like wu-ftpd. Based on changes from Oliver. --- libexec/ftpd/ftpd.c | 17 +++++++++++++++-- libexec/ftpd/pathnames.h | 3 ++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 9d32bbe00d1..879f47a72de 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.32 1997/01/23 06:49:11 deraadt Exp $ */ +/* $OpenBSD: ftpd.c,v 1.33 1997/03/25 22:47:10 millert Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -1623,11 +1623,24 @@ void cwd(path) char *path; { + FILE *message; if (chdir(path) < 0) perror_reply(550, path); - else + else { + if ((message = fopen(_PATH_CWDMESG, "r")) != NULL) { + char *cp, line[LINE_MAX]; + + while (fgets(line, sizeof(line), message) != NULL) { + if ((cp = strchr(line, '\n')) != NULL) + *cp = '\0'; + lreply(250, "%s", line); + } + (void) fflush(stdout); + (void) fclose(message); + } ack("CWD"); + } } void diff --git a/libexec/ftpd/pathnames.h b/libexec/ftpd/pathnames.h index 99d7c8bdf21..345062eff6f 100644 --- a/libexec/ftpd/pathnames.h +++ b/libexec/ftpd/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 1996/07/28 22:42:46 downsj Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 1997/03/25 22:47:08 millert Exp $ */ /* $NetBSD: pathnames.h,v 1.5 1995/04/11 02:44:59 cgd Exp $ */ /* @@ -43,3 +43,4 @@ #define _PATH_FTPWELCOME "/etc/ftpwelcome" #define _PATH_FTPLOGINMESG "/etc/motd" #define _PATH_FTPDSTATFILE "/var/log/ftpd" +#define _PATH_CWDMESG ".message" -- 2.20.1