pam_systemd_home: export password as PAM_AUTHTOK

This commit is contained in:
Christoph Ruegge 2020-11-23 18:06:36 +01:00 committed by Lennart Poettering
parent 567fe1d570
commit d2e545f88e
1 changed files with 9 additions and 0 deletions

View File

@ -625,6 +625,15 @@ static int acquire_home(
do_auth = true;
}
/* Later PAM modules may need the auth token, but only during pam_authenticate. */
if (please_authenticate && !strv_isempty(secret->password)) {
r = pam_set_item(handle, PAM_AUTHTOK, *secret->password);
if (r < 0) {
pam_syslog(handle, LOG_ERR, "Failed to set PAM auth token: %s", pam_strerror(handle, r));
return r;
}
}
r = pam_set_data(handle, fd_field, FD_TO_PTR(acquired_fd), cleanup_home_fd);
if (r < 0) {
pam_syslog(handle, LOG_ERR, "Failed to set PAM bus data: %s", pam_strerror(handle, r));