summaryrefslogtreecommitdiffstats
path: root/libexec/ftpd
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index d64bce4..1f5ce00 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -2092,12 +2092,14 @@ void
statfilecmd(char *filename)
{
FILE *fin;
+ int atstart;
int c;
char line[LINE_MAX];
(void)snprintf(line, sizeof(line), _PATH_LS " -lgA %s", filename);
fin = ftpd_popen(line, "r");
lreply(211, "status of %s:", filename);
+ atstart = 1;
while ((c = getc(fin)) != EOF) {
if (c == '\n') {
if (ferror(stdout)){
@@ -2113,7 +2115,16 @@ statfilecmd(char *filename)
}
(void) putc('\r', stdout);
}
+ /*
+ * RFC 959 says neutral text should be prepended before
+ * a leading 3-digit number followed by whitespace, but
+ * many ftp clients can be confused by any leading digits,
+ * as a matter of fact.
+ */
+ if (atstart && isdigit(c))
+ (void) putc(' ', stdout);
(void) putc(c, stdout);
+ atstart = (c == '\n');
}
(void) ftpd_pclose(fin);
reply(211, "End of Status");
OpenPOWER on IntegriCloud