From olli@lurza.secnetix.de  Wed Jun  5 12:30:02 2002
Return-Path: <olli@lurza.secnetix.de>
Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130])
	by hub.freebsd.org (Postfix) with ESMTP id 177F737B404
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  5 Jun 2002 12:30:01 -0700 (PDT)
Received: (from olli@localhost)
	by lurza.secnetix.de (8.11.6/8.11.6) id g55JTxF18891;
	Wed, 5 Jun 2002 21:29:59 +0200 (CEST)
	(envelope-from oliver.fromme@secnetix.de)
Message-Id: <200206051929.g55JTxF18891@lurza.secnetix.de>
Date: Wed, 5 Jun 2002 21:29:59 +0200 (CEST)
From: Oliver Fromme <olli@secnetix.de>
Reply-To: Oliver Fromme <olli@secnetix.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Oliver Fromme <olli@secnetix.de>
Subject: [PATCH] ftpd(8) logs aborted transfers incorrectly
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         38928
>Category:       bin
>Synopsis:       [PATCH] ftpd(8) logs aborted transfers incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    maxim
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 05 12:40:01 PDT 2002
>Closed-Date:    Wed Jul 31 00:46:39 PDT 2002
>Last-Modified:  Wed Jul 31 00:46:39 PDT 2002
>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:
State-Changed-From-To: open->patched 
State-Changed-By: maxim 
State-Changed-When: Mon Jul 1 07:31:11 PDT 2002 
State-Changed-Why:  
Fixed in rev. 1.102 src/libexec/ftpd/ftpd.c. Thanks! 


Responsible-Changed-From-To: freebsd-bugs->maxim 
Responsible-Changed-By: maxim 
Responsible-Changed-When: Mon Jul 1 07:31:11 PDT 2002 
Responsible-Changed-Why:  
I will MFC the fix. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=38928 
State-Changed-From-To: patched->closed 
State-Changed-By: maxim 
State-Changed-When: Wed Jul 31 00:45:17 PDT 2002 
State-Changed-Why:  
Fixed in libexec/ftpd/ftpd.c rev. 1.102 and rev. 1.62.2.26 in current 
and stable. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=38928 
>Unformatted:
