Subject: bin/669: ac(8) does not correctly handle i386 console logins
To: None <gnats-admin@NetBSD.ORG>
From: Simon J. Gerraty <sjg@zen.void.oz.au>
List: netbsd-bugs
Date: 12/31/1994 20:35:05
>Number:         669
>Category:       bin
>Synopsis:       ac(8) ignores logins on ttyv* (i386 console)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 31 20:35:03 1994
>Originator:     Simon J. Gerraty
>Organization:
Zen Programming...
>Release:        1.0
>Environment:
	
System: NetBSD zen.void.oz.au 1.0 NetBSD 1.0 (ZEN) #6: Tue Dec 13 09:55:20 EST 1994 root@zen.void.oz.au:/usr/src/sys/arch/i386/compile/ZEN i386


>Description:

With NetBSD-1.0, console logins on i386 are on device ttyv0 this
breaks a check in ac.c which should _probably_ only apply if
CONSOLE_TTY is defined.

>How-To-Repeat:
	Login on console, then run ac -p, the user on the console
(ttyv0) will not show up in the report.

>Fix:

*** ac.c.~1~	Sun May  1 21:41:29 1994
--- ac.c	Sun Jan  1 12:15:30 1995
***************
*** 503,511 ****
  			 * a login session if the ut_host field is non-empty
  			 */
  			if (*usr.ut_name) {
! 				if (strncmp(usr.ut_line, "tty", 3) != 0 ||
  				    strchr("pqrstuvwxy", usr.ut_line[3]) == 0 ||
  				    *usr.ut_host != '\0')
  					head = log_in(head, &usr);
  			} else
  				head = log_out(head, &usr);
--- 503,522 ----
  			 * a login session if the ut_host field is non-empty
  			 */
  			if (*usr.ut_name) {
! #ifdef CONSOLE_TTY
! 				/*
! 				 * We need to check for Console logins
! 				 * explicitly as on i386 ttyv0 is the
! 				 * console so fails the subsequent
! 				 * checks. 
! 				 * --sjg
! 				 */
! 				if (strncmp(usr.ut_line, Console,
! 					    sizeof (usr.ut_line)) == 0 ||
! 				    strncmp(usr.ut_line, "tty", 3) != 0 ||
  				    strchr("pqrstuvwxy", usr.ut_line[3]) == 0 ||
  				    *usr.ut_host != '\0')
+ #endif
  					head = log_in(head, &usr);
  			} else
  				head = log_out(head, &usr);

>Audit-Trail:
>Unformatted: