The login omits pam_acct_mgmt & chauth_tok when authentication is skipped.
Authentication may be skipped, for example, during krlogin because Kerberos
already took care of it. The problem with skipping pam_acct_mgmt is that it
allows users to use the system when maybe they should not be allowed, such that
if they have a Kerberos ticket, the other checks do not apply.
If a user had to use password authentication, pam_acct_mgmt may reject the user
for several reasons: not allowed to use the system at this time, not allowed to
use this system, user's account has been disabled, etc. Why should these tests
be skipped just because the user has a ticket?
Same with pam_chauthtok: the user may have a valid ticket, but if their
password has expired, they need to enter a new one right now.
Signed-off-by: Karel Zak <kzak@redhat.com>
pam_end(pamh, retcode);
exit(0);
}
+ }
- retcode = pam_acct_mgmt(pamh, 0);
-
- if(retcode == PAM_NEW_AUTHTOK_REQD) {
- retcode = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
- }
+ /*
+ * Authentication may be skipped (for example, during krlogin, rlogin, etc...),
+ * but it doesn't mean that we can skip other account checks. The account
+ * could be disabled or password expired (althought kerberos ticket is valid).
+ * -- kzak@redhat.com (22-Feb-2006)
+ */
+ retcode = pam_acct_mgmt(pamh, 0);
- PAM_FAIL_CHECK;
+ if(retcode == PAM_NEW_AUTHTOK_REQD) {
+ retcode = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
}
+ PAM_FAIL_CHECK;
+
/*
* Grab the user information out of the password file for future usage
* First get the username that we are actually using, though.