Subject: bin/28264: finger does not consult utmp if a username is specified
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <carton@Ivy.NET>
List: netbsd-bugs
Date: 11/12/2004 21:28:00
>Number:         28264
>Category:       bin
>Synopsis:       finger does not consult utmp if a username is specified
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 12 21:28:00 +0000 2004
>Originator:     Miles Nordin
>Release:        NetBSD 2.0_BETA 2004-08-15
>Organization:
Ivy Ministries
>Environment:
	
	
System: NetBSD castrovalva 2.0_BETA NetBSD 2.0_BETA (CASTROVALVA-$Revision: 1.7 $) #0: Thu Oct 7 20:45:13 EDT 2004 carton@castrovalva:/scratch/src/sys/arch/alpha/compile/CASTROVALVA alpha
Architecture: alpha
Machine: alpha
>Description:
'finger' and 'finger -l' will consult utmp and list the logins and idle 
times of each user.  However, 'finger carton' and 'finger -s carton' 
will not---they'll just say Last logged in at ... for -l, and will list 
idle time as '*' for -s.
>How-To-Repeat:
$ finger -s root
Login     Name                 Tty  Idle  Login Time   Office     Office Phone
root      Lulu                   *     *  No logins    
>Fix:
Index: util.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/usr.bin/finger/util.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 util.c
--- util.c	12 Dec 2003 11:39:17 -0000	1.1.1.4
+++ util.c	12 Nov 2004 21:21:24 -0000
@@ -268,7 +268,6 @@
 find_person(name)
 	char *name;
 {
-	int cnt;
 	DBT data, key;
 	PERSON *p;
 
@@ -276,7 +275,7 @@
 		return(NULL);
 
 	key.data = name;
-	key.size = cnt;
+	key.size = strlen(name);
 
 	if ((*db->get)(db, &key, &data, 0))
 		return (NULL);