Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jul 2000 18:44:00 +0900
From:      Makoto MATSUSHITA <matusita@jp.freebsd.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/20054: ftpd: rotating _PATH_FTPDSTATFILE losts xferlog
Message-ID:  <20000720184400E.matusita@jp.FreeBSD.org>

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

>Number:         20054
>Category:       bin
>Synopsis:       ftpd: rotating _PATH_FTPDSTATFILE losts xferlog
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 20 02:50:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Makoto MATSUSHITA
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Japan FreeBSD Users' Group
>Environment:

	-current, 4-stable (maybe all versions)

>Description:

	Ftpd uses two logfile. The one is for ordinally operation, and
	is recorded via syslogd(8). Another one is for file transfer,
	and is recorded by ftpd itself. Default xferlog location is
	/var/log/ftpd (macro _PATH_FTPDSTATFILE defined in <pathnames.h>),
	however, you can change the localtion by /etc/ftphosts.
	
	There is no problem about logfile via syslogd. But if you want
	to record transfer history to /var/log/ftpd and want to do some
	aging by newsyslog(8), you found ftpd is too poor to handle
	this file.

	/var/log/ftpd is opened when you logged on (ftpd.c, pass()).
	If a file retrieve is successfully done (ftpd.c, retrieve()),
	ftpd records the results via logxfer(). Yes, ftpd does assume
	that "statfd (file descriptor for /var/log/ftpd) is *always*
	available while ftpd is running". Ftpd does not consider that
	logfile is moved away, gzipped, or whatever else.

	Logfile which does not have *all* log is not a logfile. I do
	not want to loss any messages from ftpd.

>How-To-Repeat:

	* prepare logfile by 'touch /var/log/ftpd'; ftpd does not
	  record if file is not found.

	* Enable ftpd in /etc/inetd.conf, and run inetd (is default).

	* connect to ftpd.

	* get some files, then check /var/log/ftpd and you can see
	  your transfer history.

	* do "mv /var/log/ftpd /var/log/ftpd.old; touch /var/log/ftpd".
	  or use newsyslogd(8) to rotate current logfile.

	* get some files again. You cannot see any logs in /var/log/ftpd.

>Fix:
	
	Some approaches comes to me:

	1) Use syslogd for xferlog also.
		pros: avoids (potentially) all problems about logfile.
		cons: difficult to separate xferlog and others.

	2) logxfer() in ftpd.c does open(2)-write(2)-close(2) xferlog.
		pros: low impact to current implementation.
		cons: when newsyslog (or other aging tool) moves
		      xferlog, and not yet touch(1)ed, ftpd will lost
		      its logfile.

	3) ftpd re-opens xferlog iff SIGHUP is catched up.
		pros: much smarter than 2).
		cons: you may want to run standalone ftpd (-D and -p
		      option will help). daemon ftpd is maybe not
		      welcomed to not-so-busy ftp servers.

	Any approaches are welcome for me. How about 1) + "enable
	feature of 1) with yet another option ?".

>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?20000720184400E.matusita>