Fix a PAM_USER mismatch in session open/close. We update PAM_USER
to the target user immediately before setting resource limits, which is after the monitor process has forked (so it has the old value). Also, if the user did not authenticate, there is no pamh in the monitor so we need to init pam here too. This means we end up calling pam_start() twice, which should be fixed, but at least the session is always properly closed now.
This commit is contained in:
@@ -254,7 +254,7 @@ sudoers_policy_close(int exit_status, int error_code)
|
||||
|
||||
/* Close the session we opened in sudoers_policy_init_session(). */
|
||||
if (ISSET(sudo_mode, MODE_RUN|MODE_EDIT))
|
||||
(void)auth_end_session();
|
||||
(void)auth_end_session(runas_pw);
|
||||
|
||||
/* Free remaining references to password and group entries. */
|
||||
pw_delref(sudo_user.pw);
|
||||
|
Reference in New Issue
Block a user