From f497a3f1c365d883d36d4546a6c874ad25f3d573 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Mon, 22 Sep 2025 18:53:12 +0200 Subject: [PATCH 1/2] pam-util: fix build without PAM Follow-up for 882c9ce0402ec6e37201628a9a361500ff39b1ed Prompted by #39077 Note that HAVE_PAM ifdeffery in pam-util.c is removed, since its build as a whole is conditioned out if !HAVE_PAM in shared/meson.build. --- src/shared/pam-util.c | 2 -- src/shared/pam-util.h | 12 +++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/shared/pam-util.c b/src/shared/pam-util.c index a967a41bee..81ae094e85 100644 --- a/src/shared/pam-util.c +++ b/src/shared/pam-util.c @@ -16,7 +16,6 @@ #include "stdio-util.h" #include "string-util.h" -#if HAVE_PAM static void *libpam_dl = NULL; DLSYM_PROTOTYPE(pam_acct_mgmt) = NULL; @@ -61,7 +60,6 @@ int dlopen_libpam(void) { DLSYM_ARG(pam_syslog), DLSYM_ARG(pam_vsyslog)); } -#endif void pam_log_setup(void) { /* Make sure we don't leak the syslog fd we open by opening/closing the fd each time. */ diff --git a/src/shared/pam-util.h b/src/shared/pam-util.h index d33ab537eb..a4d35faa11 100644 --- a/src/shared/pam-util.h +++ b/src/shared/pam-util.h @@ -1,14 +1,13 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - #include "forward.h" #if HAVE_PAM #include #include #include /* IWYU pragma: export */ +#include #include "dlfcn-util.h" @@ -29,7 +28,6 @@ extern DLSYM_PROTOTYPE(pam_syslog); extern DLSYM_PROTOTYPE(pam_vsyslog); int dlopen_libpam(void); -#endif void pam_log_setup(void); @@ -77,3 +75,11 @@ int pam_get_data_many_internal(pam_handle_t *handle, ...) _sentinel_; #define pam_get_data_many(handle, ...) pam_get_data_many_internal(handle, __VA_ARGS__, NULL) int pam_prompt_graceful(pam_handle_t *handle, int style, char **ret_response, const char *fmt, ...) _printf_(4,5); + +#else + +static inline int dlopen_libpam(void) { + return -EOPNOTSUPP; +} + +#endif From 1fbe44d01316a521e631979f930dcffa2b656eb6 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Mon, 22 Sep 2025 17:38:57 +0200 Subject: [PATCH 2/2] pam-util,libaudit-util: strip "lib" prefix from dlopen "feature" field As per our usual coding style. --- src/shared/libaudit-util.c | 2 +- src/shared/pam-util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/libaudit-util.c b/src/shared/libaudit-util.c index 147aaf9a1d..4bdd4c1317 100644 --- a/src/shared/libaudit-util.c +++ b/src/shared/libaudit-util.c @@ -23,7 +23,7 @@ static DLSYM_PROTOTYPE(audit_open) = NULL; int dlopen_libaudit(void) { #if HAVE_AUDIT - ELF_NOTE_DLOPEN("libaudit", + ELF_NOTE_DLOPEN("audit", "Support for Audit logging", ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED, "libaudit.so.1"); diff --git a/src/shared/pam-util.c b/src/shared/pam-util.c index 81ae094e85..28fa016188 100644 --- a/src/shared/pam-util.c +++ b/src/shared/pam-util.c @@ -35,7 +35,7 @@ DLSYM_PROTOTYPE(pam_syslog) = NULL; DLSYM_PROTOTYPE(pam_vsyslog) = NULL; int dlopen_libpam(void) { - ELF_NOTE_DLOPEN("libpam", + ELF_NOTE_DLOPEN("pam", "Support for LinuxPAM", ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED, "libpam.so.0");