Date: Sun, 11 Mar 2001 05:20:03 -0800 (PST) From: Dag-Erling Smorgrav <des@ofug.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/25699: ftpd doesn't count transfered data bytes Message-ID: <200103111320.f2BDK3p12323@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/25699; it has been noted by GNATS.
From: Dag-Erling Smorgrav <des@ofug.org>
To: Yoshihiro Koya <Yoshihiro.Koya@math.yokohama-cu.ac.jp>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/25699: ftpd doesn't count transfered data bytes
Date: 11 Mar 2001 14:19:23 +0100
Yoshihiro Koya <Yoshihiro.Koya@math.yokohama-cu.ac.jp> writes:
> >Fix:
> --- /usr/src/libexec/ftpd/ftpd.c.orig Sun Mar 11 20:19:53 2001
> +++ /usr/src/libexec/ftpd/ftpd.c Sun Mar 11 20:46:15 2001
> @@ -1756,10 +1756,12 @@
> if (!cnt)
> goto oldway;
>
> + byte_count = offset;
> goto data_err;
> }
> }
>
> + byte_count = offset;
> reply(226, "Transfer complete.");
> return;
> }
Wrong patch. You set byte_count to offset, so if the transfer was
restarted in mid-file you also count bytes that *weren't* transferred.
The correct fix is:
Index: ftpd.c
===================================================================
RCS file: /home/ncvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.72
diff -u -r1.72 ftpd.c
--- ftpd.c 2000/12/20 03:34:54 1.72
+++ ftpd.c 2001/03/11 13:16:57
@@ -1749,6 +1749,7 @@
while (err != -1 && cnt < filesize) {
err = sendfile(filefd, netfd, offset, len,
(struct sf_hdtr *) NULL, &cnt, 0);
+ byte_count += cnt;
offset += cnt;
len -= cnt;
(apply with 'patch -l' due to cut&paste corruption)
DES
--
Dag-Erling Smorgrav - des@ofug.org
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?200103111320.f2BDK3p12323>
