summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordownsj <downsj@openbsd.org>1996-12-08 13:29:19 +0000
committerdownsj <downsj@openbsd.org>1996-12-08 13:29:19 +0000
commita6bcf45ce8a8704c1222f1f2d63c20112fa89e6d (patch)
tree735255ec95616a8efb0cd7d624d732aadc0f08f9
parenta few things go away... (diff)
downloadwireguard-openbsd-a6bcf45ce8a8704c1222f1f2d63c20112fa89e6d.tar.xz
wireguard-openbsd-a6bcf45ce8a8704c1222f1f2d63c20112fa89e6d.zip
Disable matching by default if a domainname is set, adding -M to reenable it.
-rw-r--r--usr.bin/finger/finger.19
-rw-r--r--usr.bin/finger/finger.c20
2 files changed, 21 insertions, 8 deletions
diff --git a/usr.bin/finger/finger.1 b/usr.bin/finger/finger.1
index e4ce23a2a92..74c4f758b84 100644
--- a/usr.bin/finger/finger.1
+++ b/usr.bin/finger/finger.1
@@ -1,4 +1,5 @@
-.\" $OpenBSD: finger.1,v 1.2 1996/06/26 05:33:15 deraadt Exp $
+.\" $OpenBSD: finger.1,v 1.3 1996/12/08 13:29:19 downsj Exp $
+.\"
.\" Copyright (c) 1989, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
@@ -40,7 +41,7 @@
.Nd user information lookup program
.Sh SYNOPSIS
.Nm finger
-.Op Fl lmsp
+.Op Fl lmMsp
.Op Ar user ...
.Op Ar user@host ...
.Sh DESCRIPTION
@@ -122,6 +123,10 @@ option is supplied.
All name matching performed by
.Nm finger
is case insensitive.
+.It Fl M
+Enable matching of
+.Ar user
+names. This is disabled by default on systems running YP.
.El
.Pp
If no options are specified,
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index c2993d08d40..3bc15431568 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: finger.c,v 1.3 1996/08/30 11:39:36 deraadt Exp $ */
+/* $OpenBSD: finger.c,v 1.4 1996/12/08 13:29:19 downsj Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -48,7 +48,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)finger.c 5.22 (Berkeley) 6/29/90";*/
-static char rcsid[] = "$OpenBSD: finger.c,v 1.3 1996/08/30 11:39:36 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: finger.c,v 1.4 1996/12/08 13:29:19 downsj Exp $";
#endif /* not lint */
/*
@@ -71,7 +71,7 @@ static char rcsid[] = "$OpenBSD: finger.c,v 1.3 1996/08/30 11:39:36 deraadt Exp
#include "finger.h"
time_t now;
-int lflag, sflag, mflag, pplan;
+int lflag, sflag, mflag, pplan, Mflag;
char tbuf[1024];
int loginlist __P((void));
@@ -84,9 +84,10 @@ main(argc, argv)
{
extern int optind;
int ch;
+ char domain[256];
time_t time();
- while ((ch = getopt(argc, argv, "lmps")) != EOF)
+ while ((ch = getopt(argc, argv, "lmMps")) != EOF)
switch(ch) {
case 'l':
lflag = 1; /* long format */
@@ -94,6 +95,9 @@ main(argc, argv)
case 'm':
mflag = 1; /* force exact match of names */
break;
+ case 'M':
+ Mflag = 1; /* allow name matching */
+ break;
case 'p':
pplan = 1; /* don't show .plan/.project */
break;
@@ -103,12 +107,16 @@ main(argc, argv)
case '?':
default:
(void)fprintf(stderr,
- "usage: finger [-lmps] [login ...]\n");
+ "usage: finger [-lmMps] [login ...]\n");
exit(1);
}
argc -= optind;
argv += optind;
+ /* if a domainname is set, increment mflag. */
+ if ((getdomainname(&domain, sizeof(domain)) == 0) && domain[0])
+ mflag++;
+
(void)time(&now);
setpassent(1);
if (!*argv) {
@@ -208,7 +216,7 @@ userlist(argc, argv)
* traverse the list of possible login names and check the login name
* and real name against the name specified by the user.
*/
- if (mflag) {
+ if ((mflag - Mflag) > 0) {
for (i = 0; i < argc; i++)
if (used[i] >= 0 && (pw = getpwnam(argv[i]))) {
enter_person(pw);