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:
@@ -274,14 +274,14 @@ int auth_begin_session(struct passwd *pw)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int auth_end_session(void)
|
||||
int auth_end_session(struct passwd *pw)
|
||||
{
|
||||
sudo_auth *auth;
|
||||
int status;
|
||||
|
||||
for (auth = auth_switch; auth->name; auth++) {
|
||||
if (auth->end_session && !IS_DISABLED(auth)) {
|
||||
status = (auth->end_session)(auth);
|
||||
status = (auth->end_session)(pw, auth);
|
||||
if (status == AUTH_FATAL) { /* XXX log */
|
||||
return -1; /* assume error msg already printed */
|
||||
}
|
||||
|
Reference in New Issue
Block a user