summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-11-28 09:31:04 +0100
committerLennart Poettering <lennart@poettering.net>2024-01-04 12:29:37 +0100
commite1ccf6b2b5ccf671f4211b9eae61a90b8cdc4144 (patch)
tree88d35a384ca45a4ed6185343d2e34c7f3c2e9238 /src
parentpam_systemd: move over to pam_get_item_many() (diff)
downloadsystemd-e1ccf6b2b5ccf671f4211b9eae61a90b8cdc4144.tar.xz
systemd-e1ccf6b2b5ccf671f4211b9eae61a90b8cdc4144.zip
pam_systemd_home: port over to pam_get_item_many()
Diffstat (limited to 'src')
-rw-r--r--src/home/pam_systemd_home.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/home/pam_systemd_home.c b/src/home/pam_systemd_home.c
index ba8d8f6054..30f624b6e2 100644
--- a/src/home/pam_systemd_home.c
+++ b/src/home/pam_systemd_home.c
@@ -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