Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 1997 13:31:08 +0800 (TSD)
From:      "Anatoly A. Orehovsky" <tolik@www.tomsk.su>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/4204: Getting wrong ac report   
Message-ID:  <199708010531.NAA05400@www.tomsk.su>
Resent-Message-ID: <199708010540.WAA00223@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4204
>Category:       bin
>Synopsis:       ac printed wrong report about tty users
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 31 22:40:00 PDT 1997
>Last-Modified:
>Originator:     Anatoly A. Orehovsky
>Organization:
CISA Ltd.
>Release:        FreeBSD 2.2.2-RELEASE i386
>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.
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708010531.NAA05400>