Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ftpd Turns out that our implementation of STAT wasn'...



details:   https://anonhg.NetBSD.org/src/rev/4eadbdf0fad6
branches:  trunk
changeset: 538667:4eadbdf0fad6
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Oct 25 01:45:37 2002 +0000

description:
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@localhost

openbsd libexec/ftpd/ftpd.c revision 1.69.

(see RFC959 page 36)

diffstat:

 libexec/ftpd/cmds.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r 03f1d4da1a59 -r 4eadbdf0fad6 libexec/ftpd/cmds.c
--- a/libexec/ftpd/cmds.c       Fri Oct 25 01:35:12 2002 +0000
+++ b/libexec/ftpd/cmds.c       Fri Oct 25 01:45:37 2002 +0000
@@ -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 @@
 #include <string.h>
 #include <tzfile.h>
 #include <unistd.h>
+#include <ctype.h>
 
 #ifdef KERBEROS5
 #include <krb5/krb5.h>
@@ -506,12 +507,14 @@
 {
        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 @@
                        }
                        CPUTC('\r', stdout);
                }
+               if (atstart && isdigit(c))
+                       CPUTC(' ', stdout);
                CPUTC(c, stdout);
+               atstart = (c == '\n');
        }
        (void) ftpd_pclose(fin);
        reply(211, "End of Status");



Home | Main Index | Thread Index | Old Index