Subject: bin/18498: ftpd logs in utmp/wtmp incorrectly
To: None <gnats-bugs@gnats.netbsd.org>
From: None <gcw@primenet.com.au>
List: netbsd-bugs
Date: 10/02/2002 17:20:34
>Number:         18498
>Category:       bin
>Synopsis:       ftpd logs in utmp/wtmp incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 02 00:21:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Geoff C. Wing
>Release:        NetBSD 1.6I (2002/10/01)
>Organization:
>Environment:
System: NetBSD sparkles.primenet.com.au 1.6I NetBSD 1.6I (SPARKLES) #0: Fri Sep 27 11:15:58 EST 2002 gcw@sparkles.primenet.com.au:/usr/netbsd/src/sys/arch/i386/compile/SPARKLES i386
Architecture: i386
Machine: i386
>Description:
	ftpd passes somes arguments in the wrong order internally and
	logs in utmp/wtmp incorrectly - thus fails wtmp logout (because
	the tty line was wrong)

	% fgrep login_utmp ftpd.c
	login_utmp(const char *name, const char *line, const char *host)
	login_utmp(pw->pw_name, remotehost, ttyline);

	% last -2
	root      ttyE0                     Wed Oct 02 17:05   still logged in
	ftp       65.243.1 ftp7820          Wed Oct 02 17:00   still logged in

>How-To-Repeat:
	try it
>Fix:
	
--- libexec/ftpd/ftpd.c.org	Sat Sep 14 10:34:11 2002
+++ libexec/ftpd/ftpd.c	Wed Oct  2 17:07:54 2002
@@ -1090,7 +1090,7 @@
 	gidcount = getgroups(sizeof(gidlist), gidlist);
 
 	/* open utmp/wtmp before chroot */
-	login_utmp(pw->pw_name, remotehost, ttyline);
+	login_utmp(pw->pw_name, ttyline, remotehost);
 
 	logged_in = 1;
 
>Release-Note:
>Audit-Trail:
>Unformatted: