Bugfixes in pam_fshadow

* pam_fshadow/pam_fshadow.c (verify_user_acct): Don't leave the file
open.
(pam_sm_authenticate): If the username was changed, set the changed value
in the PAM_USER item, for eventual use by subsequent modules in stack.
This commit is contained in:
Mirsad Goran Todorovac 2022-02-02 17:46:48 +02:00 committed by Sergey Poznyakoff
parent 9f0391c84b
commit 1af3541706

View file

@ -334,6 +334,7 @@ verify_user_acct(const char *confdir, const char *username, char **pwd)
if (strcmp (pw->pw_name, username) == 0)
break;
}
fclose(fp);
if (!pw) {
_pam_log(LOG_ERR, "user %s not found in %s",
username, filename);
@ -555,6 +556,8 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags,
break;
case PAM_SUCCESS:
_pam_log(LOG_NOTICE, "user '%s' granted access", username);
if (username != (char *) input_username)
pam_set_item(pamh, PAM_USER, username);
break;
default:
_pam_log(LOG_NOTICE, "user '%s' failed to authenticate",