summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2003-06-28 23:11:41 +0000
committerjmallett <jmallett@FreeBSD.org>2003-06-28 23:11:41 +0000
commite4f0eb6b17525e227a1bc1d660ab253005530425 (patch)
tree65c318bffb32e9de3de5b702032b6f69bb844ac4 /usr.bin
parentbff3635b312638461e1292b9a3c0427ce7b727f9 (diff)
downloadFreeBSD-src-e4f0eb6b17525e227a1bc1d660ab253005530425.zip
FreeBSD-src-e4f0eb6b17525e227a1bc1d660ab253005530425.tar.gz
Add code to keep going if you're really intent on fingering someone, but
can't use utmp(5).
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/finger/finger.15
-rw-r--r--usr.bin/finger/finger.c15
2 files changed, 16 insertions, 4 deletions
diff --git a/usr.bin/finger/finger.1 b/usr.bin/finger/finger.1
index d517497..68ac8b9 100644
--- a/usr.bin/finger/finger.1
+++ b/usr.bin/finger/finger.1
@@ -40,7 +40,7 @@
.Nd user information lookup program
.Sh SYNOPSIS
.Nm
-.Op Fl 46glmpshoT
+.Op Fl 46gklmpshoT
.Op Ar user ...\&
.Op Ar user@host ...\&
.Sh DESCRIPTION
@@ -98,6 +98,9 @@ name. It also has the side-effect of restricting the output
of the remote host when used in conjunction with the
.Fl h
option.
+.It Fl k
+Disable all use of
+.Xr utmp 5 .
.It Fl l
Produce a multi-line format displaying all of the information
described for the
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index 8aafdd5..3eac7eb 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -91,7 +91,7 @@ __FBSDID("$FreeBSD$");
DB *db;
time_t now;
-int entries, gflag, lflag, mflag, pplan, sflag, oflag, Tflag;
+int entries, gflag, kflag, lflag, mflag, pplan, sflag, oflag, Tflag;
sa_family_t family = PF_UNSPEC;
int d_first = -1;
char tbuf[1024];
@@ -108,7 +108,7 @@ option(int argc, char **argv)
optind = 1; /* reset getopt */
- while ((ch = getopt(argc, argv, "46glmpshoT")) != -1)
+ while ((ch = getopt(argc, argv, "46gklmpshoT")) != -1)
switch(ch) {
case '4':
family = AF_INET;
@@ -119,6 +119,9 @@ option(int argc, char **argv)
case 'g':
gflag = 1;
break;
+ case 'k':
+ kflag = 1; /* keep going without utmp */
+ break;
case 'l':
lflag = 1; /* long format */
break;
@@ -151,7 +154,7 @@ option(int argc, char **argv)
static void
usage(void)
{
- (void)fprintf(stderr, "usage: finger [-46lmpshoT] [login ...]\n");
+ (void)fprintf(stderr, "usage: finger [-46klmpshoT] [login ...]\n");
exit(1);
}
@@ -234,6 +237,9 @@ loginlist(void)
int r, sflag1;
char name[UT_NAMESIZE + 1];
+ if (kflag)
+ errx(1, "can't list logins without reading utmp");
+
if (!freopen(_PATH_UTMP, "r", stdin))
err(1, "%s", _PATH_UTMP);
name[UT_NAMESIZE] = '\0';
@@ -370,6 +376,9 @@ net: for (p = nargv; *p;) {
if (entries == 0)
return;
+ if (kflag)
+ return;
+
/*
* Scan thru the list of users currently logged in, saving
* appropriate data whenever a match occurs.
OpenPOWER on IntegriCloud