diff options
Diffstat (limited to 'modules/pam_lastlog/pam_lastlog.c')
-rw-r--r-- | modules/pam_lastlog/pam_lastlog.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/pam_lastlog/pam_lastlog.c b/modules/pam_lastlog/pam_lastlog.c index bd454ff..535b115 100644 --- a/modules/pam_lastlog/pam_lastlog.c +++ b/modules/pam_lastlog/pam_lastlog.c @@ -50,6 +50,23 @@ struct lastlog { # define _PATH_BTMP "/var/log/btmp" #endif +#ifndef HAVE_LOGWTMP +void logwtmp(const char * line, const char * name, const char * host) +{ + struct utmp u; + memset(&u, 0, sizeof(u)); + + u.ut_pid = getpid(); + u.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS; + strncpy(u.ut_line, line, sizeof(u.ut_line)); + strncpy(u.ut_name, name, sizeof(u.ut_name)); + strncpy(u.ut_host, host, sizeof(u.ut_host)); + gettimeofday(&(u.ut_tv), NULL); + + updwtmp(_PATH_WTMP, &u); +} +#endif + /* XXX - time before ignoring lock. Is 1 sec enough? */ #define LASTLOG_IGNORE_LOCK_TIME 1 |