1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-10 16:58:28 +03:00

pam_systemd_home: port over to pam_get_item_many()

This commit is contained in:
Lennart Poettering 2023-11-28 09:31:04 +01:00
parent c0cb9e4ae9
commit e1ccf6b2b5

View File

@ -969,13 +969,12 @@ _public_ PAM_EXTERN int pam_sm_chauthtok(
return r;
/* Start with cached credentials */
r = pam_get_item(handle, PAM_OLDAUTHTOK, (const void**) &old_password);
if (!IN_SET(r, PAM_BAD_ITEM, PAM_SUCCESS))
return pam_syslog_pam_error(handle, LOG_ERR, r, "Failed to get old password: @PAMERR@");
r = pam_get_item(handle, PAM_AUTHTOK, (const void**) &new_password);
if (!IN_SET(r, PAM_BAD_ITEM, PAM_SUCCESS))
return pam_syslog_pam_error(handle, LOG_ERR, r, "Failed to get cached password: @PAMERR@");
r = pam_get_item_many(
handle,
PAM_OLDAUTHTOK, &old_password,
PAM_AUTHTOK, &new_password);
if (r != PAM_SUCCESS)
return pam_syslog_pam_error(handle, LOG_ERR, r, "Failed to get cached passwords: @PAMERR@");
if (isempty(new_password)) {
/* No, it's not cached, then let's ask for the password and its verification, and cache