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;
|
struct tm *lt;
|
||||||
const char *dot, *t;
|
const char *dot, *t;
|
||||||
int century;
|
int century;
|
||||||
|
struct timeval tv_from, tv_to;
|
||||||
|
|
||||||
lt = localtime(&ts->tv_sec);
|
lt = localtime(&ts->tv_sec);
|
||||||
if (lt == NULL)
|
if (lt == NULL)
|
||||||
|
|
@ -357,16 +358,20 @@ setthetime(const char *fmt, const char *p, int jflag, struct timespec *ts)
|
||||||
utx.ut_type = OLD_TIME;
|
utx.ut_type = OLD_TIME;
|
||||||
memset(utx.ut_id, 0, sizeof(utx.ut_id));
|
memset(utx.ut_id, 0, sizeof(utx.ut_id));
|
||||||
(void)gettimeofday(&utx.ut_tv, NULL);
|
(void)gettimeofday(&utx.ut_tv, NULL);
|
||||||
|
tv_from = utx.ut_tv;
|
||||||
pututxline(&utx);
|
pututxline(&utx);
|
||||||
if (clock_settime(CLOCK_REALTIME, ts) != 0)
|
if (clock_settime(CLOCK_REALTIME, ts) != 0)
|
||||||
err(1, "clock_settime");
|
err(1, "clock_settime");
|
||||||
utx.ut_type = NEW_TIME;
|
utx.ut_type = NEW_TIME;
|
||||||
(void)gettimeofday(&utx.ut_tv, NULL);
|
(void)gettimeofday(&utx.ut_tv, NULL);
|
||||||
|
tv_to = utx.ut_tv;
|
||||||
pututxline(&utx);
|
pututxline(&utx);
|
||||||
|
|
||||||
if ((p = getlogin()) == NULL)
|
if ((p = getlogin()) == NULL)
|
||||||
p = "???";
|
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…
Add table
Reference in a new issue