From tolik@www.tomsk.su  Thu Jul 31 22:33:08 1997
Received: from www.tomsk.su (www.tomsk.su [193.124.185.18])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id WAA29657
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 31 Jul 1997 22:32:24 -0700 (PDT)
Received: (from tolik@localhost)
	by www.tomsk.su (8.8.5/8.8.5) id NAA05400;
	Fri, 1 Aug 1997 13:31:08 +0800 (TSD)
Message-Id: <199708010531.NAA05400@www.tomsk.su>
Date: Fri, 1 Aug 1997 13:31:08 +0800 (TSD)
From: "Anatoly A. Orehovsky" <tolik@www.tomsk.su>
Reply-To: tolik@www.tomsk.su
To: FreeBSD-gnats-submit@freebsd.org
Subject: Getting wrong ac report   
X-Send-Pr-Version: 3.2

>Number:         4204
>Category:       bin
>Synopsis:       [PATCH] ac printed wrong report about tty users
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 31 22:40:00 PDT 1997
>Closed-Date:    Sun Aug 5 02:41:36 PDT 2001
>Last-Modified:  Sun Aug 05 02:41:52 PDT 2001
>Originator:     Anatoly A. Orehovsky
>Release:        FreeBSD 2.2.2-RELEASE i386
>Organization:
CISA Ltd.
>Environment:

Correct wtmp file.

>Description:

Running ac with it any keys result in wrong printed times for tty users.
For example: running ac -p in /etc/monthly.

Also default rotate value for wtmp (168 hours) in /etc/newsyslog.conf is not
compatible with running ac -p from /etc/monthly.

>How-To-Repeat:

ac -p
ac -d
...

>Fix:
This problem is result mixed '!=' and '==' operators in ac.c(ac()).

Patch:

-- BEGIN of patch--
*** ac.c.orig	Fri Oct 27 06:10:10 1995
--- ac.c	Fri Aug  1 12:54:53 1997
***************
*** 506,513 ****
  			 * 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
--- 506,513 ----
  			 * 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

-- END of patch --

For remove noncompatibilty /etc/newsyslog.conf with /etc/monthly require
to move follow code from /etc/monthly:

--BEGIN of code
echo "Doing login accounting:"
ac -p | sort -nr +1
-- END of code --

to /etc/weekly.

And stay to receive "ac -p" report every week.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: phk 
State-Changed-When: Mon May 4 04:15:58 PDT 1998 
State-Changed-Why:  
come and get it committers! 
State-Changed-From-To: suspended->closed 
State-Changed-By: jon 
State-Changed-When: Sun Aug 5 02:41:36 PDT 2001 
State-Changed-Why:  
fixed committed in -CURRENT. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=4204 
>Unformatted:
