Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/usr.bin/finger Pull up following revision(s) (requested b...
details: https://anonhg.NetBSD.org/src/rev/5519eb241e82
branches: netbsd-9
changeset: 963869:5519eb241e82
user: martin <martin%NetBSD.org@localhost>
date: Thu May 07 18:22:58 2020 +0000
description:
Pull up following revision(s) (requested by kim in ticket #894):
usr.bin/finger/finger.1: revision 1.22
usr.bin/finger/util.c: revision 1.30
Add lastlogx support
diffstat:
usr.bin/finger/finger.1 | 22 ++++++++++++++++++----
usr.bin/finger/util.c | 33 +++++++++++++++++++++++++++++----
2 files changed, 47 insertions(+), 8 deletions(-)
diffs (120 lines):
diff -r da70deb24b33 -r 5519eb241e82 usr.bin/finger/finger.1
--- a/usr.bin/finger/finger.1 Thu May 07 18:19:28 2020 +0000
+++ b/usr.bin/finger/finger.1 Thu May 07 18:22:58 2020 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: finger.1,v 1.19 2016/12/22 12:39:40 abhinav Exp $
+.\" $NetBSD: finger.1,v 1.19.16.1 2020/05/07 18:22:58 martin Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)finger.1 8.3 (Berkeley) 5/5/94
.\"
-.Dd December 25, 2014
+.Dd May 7, 2020
.Dt FINGER 1
.Os
.Sh NAME
@@ -199,9 +199,23 @@
.Fl l
option is the only option that may be passed to a remote machine.
.Sh FILES
-.Bl -tag -width /var/log/lastlog -compact
+.Bl -tag -width /var/log/lastlogx -compact
+.It Pa /var/run/utmpx
+The
+.Nm utmpx
+file.
+.It Pa /var/log/lastlogx
+The
+.Nm lastlogx
+file.
+.It Pa /var/run/utmp
+The
+.Nm utmp
+file.
.It Pa /var/log/lastlog
-last login data base
+The
+.Nm lastlog
+file.
.El
.Sh SEE ALSO
.Xr chpass 1 ,
diff -r da70deb24b33 -r 5519eb241e82 usr.bin/finger/util.c
--- a/usr.bin/finger/util.c Thu May 07 18:19:28 2020 +0000
+++ b/usr.bin/finger/util.c Thu May 07 18:22:58 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.29 2016/03/09 16:12:14 chs Exp $ */
+/* $NetBSD: util.c,v 1.29.18.1 2020/05/07 18:22:58 martin Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -72,7 +72,7 @@
#if 0
static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: util.c,v 1.29 2016/03/09 16:12:14 chs Exp $");
+__RCSID("$NetBSD: util.c,v 1.29.18.1 2020/05/07 18:22:58 martin Exp $");
#endif
#endif /* not lint */
@@ -90,7 +90,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <utmp.h>
#include "utmpentry.h"
@@ -160,15 +159,40 @@
enter_lastlog(PERSON *pn)
{
WHERE *w;
- static int opened, fd;
+ static int opened;
+#ifdef SUPPORT_UTMPX
+# define ll_time ll_tv.tv_sec
+# define UT_LINESIZE _UTX_LINESIZE
+# define UT_HOSTSIZE _UTX_HOSTSIZE
+ static DB *lldb = NULL;
+ DBT key, data;
+ struct lastlogx ll;
+#else
+ static int fd;
struct lastlog ll;
+#endif
char doit = 0;
+ (void)memset(&ll, 0, sizeof(ll));
+
/* some systems may not maintain lastlog, don't report errors. */
if (!opened) {
+#ifdef SUPPORT_UTMPX
+ lldb = dbopen(_PATH_LASTLOGX, O_RDONLY|O_SHLOCK, 0, DB_HASH, NULL);
+#else
fd = open(_PATH_LASTLOG, O_RDONLY, 0);
+#endif
opened = 1;
}
+#ifdef SUPPORT_UTMPX
+ if (lldb != NULL) {
+ key.data = &pn->uid;
+ key.size = sizeof(pn->uid);
+ if ((*lldb->get)(lldb, &key, &data, 0) == 0 &&
+ data.size == sizeof(ll))
+ (void)memcpy(&ll, data.data, sizeof(ll));
+ }
+#else
if (fd == -1 ||
lseek(fd, (off_t)pn->uid * sizeof(ll), SEEK_SET) !=
(off_t)pn->uid * (off_t)sizeof(ll) ||
@@ -177,6 +201,7 @@
ll.ll_line[0] = ll.ll_host[0] = '\0';
ll.ll_time = 0;
}
+#endif
if ((w = pn->whead) == NULL)
doit = 1;
else if (ll.ll_time != 0) {
Home |
Main Index |
Thread Index |
Old Index