diff options
Diffstat (limited to 'lib/libpam/modules/pam_lastlog/pam_lastlog.c')
-rw-r--r-- | lib/libpam/modules/pam_lastlog/pam_lastlog.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.c b/lib/libpam/modules/pam_lastlog/pam_lastlog.c index 14e47b80..72bb942 100644 --- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c +++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #define _BSD_SOURCE #include <sys/time.h> + +#include <paths.h> #include <pwd.h> #include <stdlib.h> #include <string.h> @@ -96,6 +98,9 @@ pam_sm_open_session(pam_handle_t *pamh, int flags, pam_err = PAM_SERVICE_ERR; goto err; } + /* Strip /dev/ component. */ + if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + tty = (const char *)tty + sizeof(_PATH_DEV) - 1; if ((flags & PAM_SILENT) == 0) { if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) { |