Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jul 2000 22:20:04 -0700 (PDT)
From:      Makoto MATSUSHITA <matusita@jp.freebsd.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/20054: ftpd: rotating _PATH_FTPDSTATFILE losts xferlog
Message-ID:  <200007250520.WAA73685@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/20054; it has been noted by GNATS.

From: Makoto MATSUSHITA <matusita@jp.freebsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/20054: ftpd: rotating _PATH_FTPDSTATFILE losts xferlog
Date: Tue, 25 Jul 2000 14:18:58 +0900

 matusita> 	How about 1) + "enable feature of 1) with yet another
 matusita> 	option ?".
 
 Here is an sample implementation. New option '-s', just like '-S' but
 uses syslog() to record.
 
 -- -
 Makoto `MAR' MATSUSHITA
 
 Index: ftpd.c
 ===================================================================
 RCS file: /pub/cvsup/FreeBSD.cvs/src/libexec/ftpd/ftpd.c,v
 retrieving revision 1.64
 diff -c -r1.64 ftpd.c
 *** ftpd.c	2000/06/26 05:36:09	1.64
 --- ftpd.c	2000/07/25 05:10:43
 ***************
 *** 141,146 ****
 --- 141,147 ----
   int	dochroot;
   int	stats;
   int	statfd = -1;
 + int	statssyslog;
   int	type;
   int	form;
   int	stru;			/* avoid C keyword */
 ***************
 *** 290,296 ****
   #endif /* OLD_SETPROCTITLE */
   
   
 ! 	while ((ch = getopt(argc, argv, "AdlDSURt:T:u:va:p:46")) != -1) {
   		switch (ch) {
   		case 'D':
   			daemon_mode++;
 --- 291,297 ----
   #endif /* OLD_SETPROCTITLE */
   
   
 ! 	while ((ch = getopt(argc, argv, "AdlDSsURt:T:u:va:p:46")) != -1) {
   		switch (ch) {
   		case 'D':
   			daemon_mode++;
 ***************
 *** 312,317 ****
 --- 313,322 ----
   			stats++;
   			break;
   
 + 		case 's':
 + 			statssyslog++;
 + 			break;
 + 
   		case 'T':
   			maxtimeout = atoi(optarg);
   			if (timeout > maxtimeout)
 ***************
 *** 1435,1441 ****
   	time(&start);
   	send_data(fin, dout, st.st_blksize, st.st_size,
   		  restart_point == 0 && cmd == 0 && S_ISREG(st.st_mode));
 ! 	if (cmd == 0 && guest && stats)
   		logxfer(name, st.st_size, start);
   	(void) fclose(dout);
   	data = -1;
 --- 1440,1446 ----
   	time(&start);
   	send_data(fin, dout, st.st_blksize, st.st_size,
   		  restart_point == 0 && cmd == 0 && S_ISREG(st.st_mode));
 ! 	if (cmd == 0 && guest && (stats || statssyslog))
   		logxfer(name, st.st_size, start);
   	(void) fclose(dout);
   	data = -1;
 ***************
 *** 2777,2787 ****
   	char path[MAXPATHLEN + 1];
   	time_t now;
   
 ! 	if (statfd >= 0 && getwd(path) != NULL) {
   		time(&now);
   		snprintf(buf, sizeof(buf), "%.20s!%s!%s!%s/%s!%ld!%ld\n",
   			ctime(&now)+4, ident, remotehost,
   			path, name, size, now - start + (now == start));
 ! 		write(statfd, buf, strlen(buf));
   	}
   }
 --- 2782,2795 ----
   	char path[MAXPATHLEN + 1];
   	time_t now;
   
 ! 	if (getwd(path) != NULL) {
   		time(&now);
   		snprintf(buf, sizeof(buf), "%.20s!%s!%s!%s/%s!%ld!%ld\n",
   			ctime(&now)+4, ident, remotehost,
   			path, name, size, now - start + (now == start));
 ! 		if (statfd >= 0)
 ! 			write(statfd, buf, strlen(buf));
 ! 		if (statssyslog)
 ! 			syslog(LOG_INFO, buf);
   	}
   }
 


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?200007250520.WAA73685>