diff options
author | des <des@FreeBSD.org> | 2004-01-26 19:28:37 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2004-01-26 19:28:37 +0000 |
commit | 2549da444c26a02cfd246f858cad2bc971e94c21 (patch) | |
tree | c731d19e26bfbb5d185be71a12ae99d7e61c919f /lib | |
parent | 6957e03ab337c08430a371dc3d1cce6f727ee2e9 (diff) | |
download | FreeBSD-src-2549da444c26a02cfd246f858cad2bc971e94c21.zip FreeBSD-src-2549da444c26a02cfd246f858cad2bc971e94c21.tar.gz |
Implement pam_sm_close_session().
PR: bin/61657
Submitted by: Joe R. Doupnik <jrd@cc.usu.edu>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libpam/modules/pam_lastlog/pam_lastlog.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.c b/lib/libpam/modules/pam_lastlog/pam_lastlog.c index 9a1daf2..519d452 100644 --- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c +++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c @@ -5,6 +5,8 @@ * All rights reserved. * Copyright (c) 2001 Networks Associates Technology, Inc. * All rights reserved. + * Copyright (c) 2004 Joe R. Doupnik + * All rights reserved. * * Portions of this software were developed for the FreeBSD Project by * ThinkSec AS and NAI Labs, the Security Research Division of Network @@ -168,8 +170,18 @@ PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh __unused, int flags __unused, int argc __unused, const char *argv[] __unused) { + const void *tty; - return (PAM_SUCCESS); + pam_get_item(pamh, PAM_TTY, (const void **)&tty); + if (strncmp(tty, _PATH_DEV, strlen(_PATH_DEV)) == 0) + tty = (const char *)tty + strlen(_PATH_DEV); + if (*(const char *)tty == '\0') + return (PAM_SERVICE_ERR); + if (logout(tty) != 1) + syslog(LOG_ERR, "%s(): no utmp record for %s", + __func__, (const char *)tty); + logwtmp(tty, "", ""); + return (PAM_SUCCESS); } PAM_MODULE_ENTRY("pam_lastlog"); |