mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
date: Include old and new time in audit log (#221)
This commit is contained in:
parent
fbd2bda109
commit
1d4749d254
1 changed files with 6 additions and 1 deletions
|
|
@ -265,6 +265,7 @@ setthetime(const char *fmt, const char *p, int jflag, struct timespec *ts)
|
|||
struct tm *lt;
|
||||
const char *dot, *t;
|
||||
int century;
|
||||
struct timeval tv_from, tv_to;
|
||||
|
||||
lt = localtime(&ts->tv_sec);
|
||||
if (lt == NULL)
|
||||
|
|
@ -357,16 +358,20 @@ setthetime(const char *fmt, const char *p, int jflag, struct timespec *ts)
|
|||
utx.ut_type = OLD_TIME;
|
||||
memset(utx.ut_id, 0, sizeof(utx.ut_id));
|
||||
(void)gettimeofday(&utx.ut_tv, NULL);
|
||||
tv_from = utx.ut_tv;
|
||||
pututxline(&utx);
|
||||
if (clock_settime(CLOCK_REALTIME, ts) != 0)
|
||||
err(1, "clock_settime");
|
||||
utx.ut_type = NEW_TIME;
|
||||
(void)gettimeofday(&utx.ut_tv, NULL);
|
||||
tv_to = utx.ut_tv;
|
||||
pututxline(&utx);
|
||||
|
||||
if ((p = getlogin()) == NULL)
|
||||
p = "???";
|
||||
syslog(LOG_AUTH | LOG_NOTICE, "date set by %s", p);
|
||||
syslog(LOG_AUTH | LOG_NOTICE, "date set from %ld "
|
||||
"to %ld by %s",
|
||||
(long)tv_from.tv_sec, (long)tv_to.tv_sec, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue