summaryrefslogtreecommitdiffstats
path: root/lib/libpam/modules
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-01-13 18:32:31 +0000
committered <ed@FreeBSD.org>2010-01-13 18:32:31 +0000
commite846918be8ea79d3ca09a77e4fd6e850856f0b81 (patch)
tree4e59f94f2cc107cec1e04609c0e247c263b081f9 /lib/libpam/modules
parent6dd5ce59c1f83726b050d89474c42f34919a7395 (diff)
downloadFreeBSD-src-e846918be8ea79d3ca09a77e4fd6e850856f0b81.zip
FreeBSD-src-e846918be8ea79d3ca09a77e4fd6e850856f0b81.tar.gz
Let pam_lastlog use utmpx instead of libulog's utmpx interface.
It will still use ulog_login(3) and ulog_logout(3), which will remain present.
Diffstat (limited to 'lib/libpam/modules')
-rw-r--r--lib/libpam/modules/pam_lastlog/pam_lastlog.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.c b/lib/libpam/modules/pam_lastlog/pam_lastlog.c
index 47c1e99..3c81a59 100644
--- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c
+++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <pwd.h>
#include <time.h>
#include <ulog.h>
+#include <utmpx.h>
#define PAM_SM_SESSION
@@ -61,7 +62,7 @@ pam_sm_open_session(pam_handle_t *pamh, int flags,
int argc __unused, const char *argv[] __unused)
{
struct passwd *pwd;
- struct ulog_utmpx *utx;
+ struct utmpx *utx;
time_t t;
const char *user;
const void *rhost, *tty;
@@ -91,10 +92,10 @@ pam_sm_open_session(pam_handle_t *pamh, int flags,
}
if ((flags & PAM_SILENT) == 0) {
- if (ulog_setutxfile(UTXI_USER, NULL) != 0) {
- PAM_LOG("Failed to open lastlog database");
+ if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) {
+ PAM_LOG("Failed to open lastlogin database");
} else {
- utx = ulog_getutxuser(user);
+ utx = getutxuser(user);
if (utx != NULL && utx->ut_type == USER_PROCESS) {
t = utx->ut_tv.tv_sec;
if (*utx->ut_host != '\0')
@@ -104,7 +105,7 @@ pam_sm_open_session(pam_handle_t *pamh, int flags,
pam_info(pamh, "Last login: %.*s on %s",
24 - 5, ctime(&t), utx->ut_line);
}
- ulog_endutxent();
+ endutxent();
}
}
OpenPOWER on IntegriCloud