According to Linux-PAM's pam_setcred(3) and su implementation,
credentials shall be set before session is opened.
Adjust login to follow this rule, which is also applied by util-linux
login/su and at least gdm (didn't check more implementations).
The current style matches Appendix B of X/Open RFC 86.0 (from 1995).
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
}
PAM_FAIL_CHECK;
- /* Open the PAM session */
- get_pam_user (&pam_user);
- retcode = pam_open_session (pamh, hushed (pam_user) ? PAM_SILENT : 0);
- 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.
*
* into account.
*/
+ /* Open the PAM session */
+ get_pam_user (&pam_user);
+ retcode = pam_open_session (pamh, hushed (pam_user) ? PAM_SILENT : 0);
+ PAM_FAIL_CHECK;
+
#else /* ! USE_PAM */
while (true) { /* repeatedly get login/password pairs */
bool failed;