Subject: bin/34656: fix for pppd logwtmpx stuff
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <gcw@primenet.com.au>
List: netbsd-bugs
Date: 09/29/2006 02:30:00
>Number:         34656
>Category:       bin
>Synopsis:       pppd has stuffed up wtmpx code
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 29 02:30:00 +0000 2006
>Originator:     Geoff C. Wing
>Release:        NetBSD 4.99.3 (2006-09-29)
>Organization:
>Environment:
System: NetBSD g.primenet.com.au 4.99.3 NetBSD 4.99.3 (G) #0: Tue Sep 26 12:31:13 EST 2006 gcw@g.primenet.com.au:/usr/netbsd/src/sys/arch/i386/compile/G i386
Architecture: i386
Machine: i386
>Description:
	The logwtmpx code in pppd is dysfunctional.  The logout code is where
	login code should be.
>How-To-Repeat:
	use pppd
>Fix:
	
--- dist/pppd/pppd/auth.c.org	2006-06-30 08:36:35.000000000 +1000
+++ dist/pppd/pppd/auth.c	2006-09-28 12:09:45.000000000 +1000
@@ -1667,7 +1667,7 @@
     logwtmp(tty, user, ifname);		/* Add wtmp login entry */
 #endif
 #ifdef SUPPORT_UTMPX
-    logwtmpx(tty, "", "", 0, DEAD_PROCESS);	/* Wipe out utmp logout entry */
+    logwtmpx(tty, user, ifname, 0, USER_PROCESS);	/* Add wtmpx login entry */
 #endif
 
 #if defined(_PATH_LASTLOG) && !defined(USE_PAM)
@@ -1714,7 +1714,12 @@
     tty = devnam;
     if (strncmp(tty, "/dev/", 5) == 0)
 	tty += 5;
+#ifdef SUPPORT_UTMP
     logwtmp(tty, "", "");		/* Wipe out utmp logout entry */
+#endif
+#ifdef SUPPORT_UTMPX
+    logwtmpx(tty, "", "", 0, DEAD_PROCESS);	/* Wipe out utmp logout entry */
+#endif
     logged_in = 0;
 }