Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2002 21:29:59 +0200 (CEST)
From:      Oliver Fromme <olli@secnetix.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Oliver Fromme <olli@secnetix.de>
Subject:   bin/38928: [PATCH] ftpd(8) logs aborted transfers incorrectly
Message-ID:  <200206051929.g55JTxF18891@lurza.secnetix.de>

next in thread | raw e-mail | index | archive | help

>Number:         38928
>Category:       bin
>Synopsis:       [PATCH] ftpd(8) logs aborted transfers incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 05 12:40:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Fromme
>Release:        FreeBSD 4.6-RC2 i386
>Organization:
secnetix GmbH, Munich, Germany
>Environment:
FreeBSD 4.6-RC2 i386


>Description:

   When running ftpd with the -ll flags (i.e. log every transfer)
   and a transfer is aborted (the client user presses Ctrl-C or
   whatever), then the transfer size logged via syslog is always
   0 bytes, no matter how much had been transferred thus far.

   (This might be a serious problem for sites who use the log
   information for service accounting or traffic statistics,
   which is the only reason why I made the priority of the PR
   "medium" instead of "low".)

>How-To-Repeat:

   Connect an FTP client to a FreeBSD box running ftpd -ll
   (and syslog properly configured), initiate download of a
   file which is large enough, and press Ctrl-C when it's
   halfway through.  Note that "0 bytes" will be written to
   the log.

>Fix:

--- src/libexec/ftpd/ftpd.c.orig	Fri Mar 15 19:37:50 2002
+++ src/libexec/ftpd/ftpd.c	Wed Jun  5 20:54:55 2002
@@ -1806,9 +1806,9 @@
 			while (err != -1 && filesize > 0) {
 				err = sendfile(filefd, netfd, offset, 0,
 					(struct sf_hdtr *) NULL, &cnt, 0);
+				byte_count += cnt;
 				if (recvurg)
 					goto got_oob;
-				byte_count += cnt;
 				offset += cnt;
 				filesize -= cnt;
 
>Release-Note:
>Audit-Trail:
>Unformatted:

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?200206051929.g55JTxF18891>