Subject: bin/33261: [PATCH] ftpd does not update wtmpx
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <fun@naobsd.org>
List: netbsd-bugs
Date: 04/15/2006 07:15:00
>Number:         33261
>Category:       bin
>Synopsis:       [PATCH] ftpd does not update wtmpx
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 15 07:15:00 +0000 2006
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 3.99.17
>Organization:
	FUKAUMI Naoki
>Environment:
System: NetBSD gigalandisk.naobsd.org 3.99.17 NetBSD 3.99.17 (GENERIC) #0: Sun Apr 9 22:46:24 JST 2006 root@build.naobsd.org:/usr/obj/gigalandisk/sys/arch/gigalandisk/compile/GENERIC gigalandisk
Architecture: arm
Machine: gigalandisk
>Description:
	ftpd(8) does not update wtmpx.
>How-To-Repeat:
	Enable ftpd and login ftpd.
	No ftp session is listed in last(1).
>Fix:
	The latter half of this patch fixes this problem.

Index: libexec/ftpd/logwtmp.c
===================================================================
RCS file: /cvsroot/src/libexec/ftpd/logwtmp.c,v
retrieving revision 1.24
diff -u -p -r1.24 logwtmp.c
--- libexec/ftpd/logwtmp.c	23 Jun 2005 04:20:41 -0000	1.24
+++ libexec/ftpd/logwtmp.c	15 Apr 2006 06:59:24 -0000
@@ -89,7 +89,7 @@ ftpd_logwtmp(const char *line, const cha
 	struct utmp ut;
 	struct stat buf;
 
-	if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0)
+	if (fd < 0)
 		return;
 	if (fstat(fd, &buf) == 0) {
 		(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
@@ -110,7 +110,7 @@ void
 ftpd_initwtmpx(void)
 {
 	const char *wf = _PATH_WTMPX;
-	if ((fd = open(wf, O_WRONLY|O_APPEND, 0)) == -1)
+	if ((fdx = open(wf, O_WRONLY|O_APPEND, 0)) == -1)
 		syslog(LOG_ERR, "Cannot open `%s' (%m)", wf);
 }