Subject: Re: bin/4136: pppd should log to lastlog if it logs to wtmp
To: None <netbsd-bugs@NetBSD.ORG>
From: Geoff Wing <mason@primenet.com.au>
List: netbsd-bugs
Date: 09/23/1997 07:46:05
mason@primenet.com.au <mason@primenet.com.au> typed:
:>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.
:>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)
Oh, and including <fcntl.h> and <utmp.h> might be good too :-)
:*** /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);
--
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/> ]