[tac_plus] Accounting time off

Daniel Schmidt daniel.schmidt at wyo.gov
Wed Apr 25 21:53:47 UTC 2012


Much better.  Thkx.

-----Original Message-----
From: heasley [mailto:heas at shrubbery.net]
Sent: Wednesday, April 25, 2012 12:44 PM
To: Daniel Schmidt
Cc: heasley; tac_plus at shrubbery.net
Subject: Re: [tac_plus] Accounting time off

Wed, Apr 25, 2012 at 11:30:52AM -0600, Daniel Schmidt:
> Make no sense.  Only difference between 1 and 2 is a sudo make install
> from .19 and .25 directory and restarting service.  Find/replace only
> on user * ip's.  Where would TZ be set in the code?

its not; its inheritted from the process that starts it.

> # tail -n2 /var/log/tacacs
> Apr 25 17:27:18 1.1.1.1       homer    tty2    2.2.2.2  stop
> task_id=101     timezone=MDT    service=shell   start_time=1335374838
> priv-lvl=15     cmd=write <cr>
> Wed Apr 25 11:28:01 2012        1.1.1.1       homer    tty2    2.2.2.2
> stop    task_id=102     timezone=MDT    service=shell
> start_time=1335374881   priv-lvl=15     cmd=write <cr>

shit, this change was added in F4.0.4.20; sorry missed that in the logs.
so, hrm, but in order for it to use the inheritted timezone, it'd have to
use localtime instead of gmtime.

r3374 | heas | 2011-01-20 00:16:17 +0000 (Thu, 20 Jan 2011) | 2 lines

- change accounting log time format to match syslog


Index: do_acct.c
===================================================================
--- do_acct.c   (revision 3199)
+++ do_acct.c   (revision 3375)
@@ -20,6 +20,7 @@
  */

 #include "tac_plus.h"
+#include <limits.h>
 #include <time.h>
 #if defined(__DragonFly__) && !defined(O_SYNC)
 #define        O_SYNC  O_FSYNC
@@ -69,9 +70,11 @@
 {
     int i, errors;
     time_t t = time(NULL);
-    char *ct = ctime(&t);
+    char ct[LINE_MAX];
+    struct tm *tm;

-    ct[24] = '\0';
+    tm = gmtime(&t);
+    strftime(ct, LINE_MAX, "%h %e %T", tm);

     if (!acctfd) {
        acctfd = open(session.acctfile, O_CREAT | O_WRONLY | O_APPEND,
0644);
E-Mail to and from me, in connection with the transaction 
of public business, is subject to the Wyoming Public Records 
Act and may be disclosed to third parties.



More information about the tac_plus mailing list