summaryrefslogtreecommitdiff
path: root/modules/pam_lastlog
diff options
context:
space:
mode:
authorkukuk <kukuk@thkukuk.de>2011-05-04 17:26:16 +0200
committerkukuk <kukuk@thkukuk.de>2011-05-04 17:26:16 +0200
commit6ee536baa197e2d78019e6eab3990c0b9d367fb8 (patch)
tree6712359f4c186e8f6da7a079b3e8f97a474bd589 /modules/pam_lastlog
parent7698a76cf4983fe69944a810305183f1fe6cc031 (diff)
2011-05-04 Thorsten Kukuk <kukuk@thkukuk.de>
* modules/pam_lastlog/pam_lastlog.c (last_login_failed): Don't abort with error if btmp file does not exist.
Diffstat (limited to 'modules/pam_lastlog')
-rw-r--r--modules/pam_lastlog/pam_lastlog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/pam_lastlog/pam_lastlog.c b/modules/pam_lastlog/pam_lastlog.c
index b44c1755..9e8da7d2 100644
--- a/modules/pam_lastlog/pam_lastlog.c
+++ b/modules/pam_lastlog/pam_lastlog.c
@@ -403,9 +403,13 @@ last_login_failed(pam_handle_t *pamh, int announce, const char *user, time_t llt
/* obtain the failed login attempt records from btmp */
fd = open(_PATH_BTMP, O_RDONLY);
if (fd < 0) {
+ int save_errno = errno;
pam_syslog(pamh, LOG_ERR, "unable to open %s: %m", _PATH_BTMP);
D(("unable to open %s file", _PATH_BTMP));
- return PAM_SERVICE_ERR;
+ if (save_errno == ENOENT)
+ return PAM_SUCCESS;
+ else
+ return PAM_SERVICE_ERR;
}
while ((retval=pam_modutil_read(fd, (void *)&ut,