Turns out that our implementation of STAT wasn't RFC 959 compliant.
This version is now RFC 959 compliant, using a patch adapted from one sent in by david.leonard@eecs.uq.edu.au openbsd libexec/ftpd/ftpd.c revision 1.69. (see RFC959 page 36)
This commit is contained in:
parent
8131f239bf
commit
4af2926283
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cmds.c,v 1.18 2002/10/12 08:35:16 darrenr Exp $ */
|
||||
/* $NetBSD: cmds.c,v 1.19 2002/10/25 01:45:37 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
|
||||
@ -101,7 +101,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: cmds.c,v 1.18 2002/10/12 08:35:16 darrenr Exp $");
|
||||
__RCSID("$NetBSD: cmds.c,v 1.19 2002/10/25 01:45:37 itojun Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -117,6 +117,7 @@ __RCSID("$NetBSD: cmds.c,v 1.18 2002/10/12 08:35:16 darrenr Exp $");
|
||||
#include <string.h>
|
||||
#include <tzfile.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef KERBEROS5
|
||||
#include <krb5/krb5.h>
|
||||
@ -506,12 +507,14 @@ statfilecmd(const char *filename)
|
||||
{
|
||||
FILE *fin;
|
||||
int c;
|
||||
int atstart;
|
||||
char *argv[] = { INTERNAL_LS, "-lgA", "", NULL };
|
||||
|
||||
argv[2] = (char *)filename;
|
||||
fin = ftpd_popen(argv, "r", STDOUT_FILENO);
|
||||
reply(-211, "status of %s:", filename);
|
||||
/* XXX: use fgetln() or fparseln() here? */
|
||||
atstart = 1;
|
||||
while ((c = getc(fin)) != EOF) {
|
||||
if (c == '\n') {
|
||||
if (ferror(stdout)){
|
||||
@ -527,7 +530,10 @@ statfilecmd(const char *filename)
|
||||
}
|
||||
CPUTC('\r', stdout);
|
||||
}
|
||||
if (atstart && isdigit(c))
|
||||
CPUTC(' ', stdout);
|
||||
CPUTC(c, stdout);
|
||||
atstart = (c == '\n');
|
||||
}
|
||||
(void) ftpd_pclose(fin);
|
||||
reply(211, "End of Status");
|
||||
|
Loading…
Reference in New Issue
Block a user