Subject: bin/4136: pppd should log to lastlog if it logs to wtmp
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mason@primenet.com.au>
List: netbsd-bugs
Date: 09/22/1997 08:27:37
>Number: 4136
>Category: bin
>Synopsis: pppd can write to wtmp (via option) but does write to lastlog
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 22 01:35:00 1997
>Last-Modified:
>Originator: Geoff Wing
>Organization:
Geoff Wing [mason@primenet.com.au] Phone : +61-3-9818 2977
Technical Manager: PrimeNet Computer Consultants Facsimile: +61-3-9768 2909
Web: <URL:http://www.primenet.com.au/> Mobile : 0412 162 441
[ Boulderdash: <URL:http://ciips.ee.uwa.edu.au/~williams/bd/> ]
>Release: -current
>Environment:
System: NetBSD coral.primenet.com.au 1.2G NetBSD 1.2G (CORAL) #15: Tue Sep 9 21:10:53 EST 1997 mason@coral.primenet.com.au:/src/netbsd/src/sys/arch/i386/compile/CORAL i386
>Description:
Using the `login' option of pppd, it writes login information to
/var/log/wtmp but not /var/log/lastlog . login (of course) and uucpd
write to both. These should be consistent, and implied in the man
page for lastlog it indicates that logins to wtmp should also be
reflected in lastlog.
>How-To-Repeat:
code reading
>Fix:
Possibly the man page should also be updated? (I haven't looked at
other OSs so there might be a more portable way to check for lastlog)
*** /usr/src/usr.sbin/pppd/pppd/auth.c Sat Jun 28 22:08:58 1997
--- /usr/obj/usr.sbin/pppd/pppd/auth.c Mon Sep 22 17:29:12 1997
***************
*** 807,812 ****
--- 807,828 ----
if (strncmp(tty, "/dev/", 5) == 0)
tty += 5;
logwtmp(tty, user, remote_name); /* Add wtmp login entry */
+
+ #ifdef _PATH_LASTLOG
+ {
+ struct lastlog ll;
+ int fd;
+
+ if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) {
+ (void)lseek(fd, (off_t)(pw->pw_uid * sizeof(ll)), SEEK_SET);
+ memset((void *)&ll, 0, sizeof(ll));
+ (void)time(&ll.ll_time);
+ (void)strncpy(ll.ll_line, tty, sizeof(ll.ll_line));
+ (void)write(fd, (char *)&ll, sizeof(ll));
+ (void)close(fd);
+ }
+ }
+ #endif
logged_in = TRUE;
return (UPAP_AUTHACK);
>Audit-Trail:
>Unformatted: