From fcb1fe299c6863ab2806dec408c7653123a5d828 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Tue, 8 Aug 2023 02:37:24 +0200 Subject: [PATCH] pam: fix cache id Something went wrong in the cherry-picking for 3fc9c413a9bd44b77c7ee8b5dc7decb05e9f2d43. Bus is not stored correctly in the cache. Because authentication calls `pam_acquire_bus_connection` twice, and the first created bus is used after the second one is created, `pam_set_data` disconnects the first one. This results in the following error: ``` Failed to acquire home for user test-user: Transport endpoint is not connected ``` --- src/shared/pam-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/pam-util.c b/src/shared/pam-util.c index c8163044bfe..345442ee6f1 100644 --- a/src/shared/pam-util.c +++ b/src/shared/pam-util.c @@ -62,7 +62,7 @@ int pam_acquire_bus_connection(pam_handle_t *handle, const char *module_name, sd return PAM_SERVICE_ERR; } - r = pam_set_data(handle, "systemd-system-bus", bus, cleanup_system_bus); + r = pam_set_data(handle, cache_id, bus, cleanup_system_bus); if (r != PAM_SUCCESS) { pam_syslog(handle, LOG_ERR, "Failed to set PAM bus data: %s", pam_strerror(handle, r)); return r;