]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
pam_lastlog2: fix libpam linking in autotools build
authorKarel Zak <kzak@redhat.com>
Tue, 19 May 2026 08:54:57 +0000 (10:54 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 19 May 2026 08:54:57 +0000 (10:54 +0200)
Move -lpam from LDFLAGS to LIBADD. When -lpam is in LDFLAGS it
appears on the linker command line before object files, so the
--as-needed linker flag (default on Fedora) discards it before
seeing any undefined PAM symbols. This results in pam_lastlog2.so
missing libpam.so in its ELF NEEDED entries.

The module then fails to load with dlopen() if the calling process
does not itself link against libpam (e.g., systemd in Fedora 44+):

  PAM unable to dlopen(pam_lastlog2.so): undefined symbol: pam_syslog

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2453457
Signed-off-by: Karel Zak <kzak@redhat.com>
pam_lastlog2/src/Makemodule.am

index 62993085389d364beb243f140e60704defdb36ce..876171e9fc8af761df8b93303e75e5d5277292e0 100644 (file)
@@ -11,9 +11,9 @@ pam_lastlog2_la_CFLAGS = \
         $(SOLIB_CFLAGS) \
         -I$(ul_liblastlog2_incdir)
 
-pam_lastlog2_la_LIBADD = liblastlog2.la
+pam_lastlog2_la_LIBADD = liblastlog2.la -lpam
 
-pam_lastlog2_la_LDFLAGS = $(SOLIB_LDFLAGS) -lpam -module -avoid-version -shared
+pam_lastlog2_la_LDFLAGS = $(SOLIB_LDFLAGS) -module -avoid-version -shared
 if HAVE_VSCRIPT
 pam_lastlog2_la_LDFLAGS += $(VSCRIPT_LDFLAGS),$(top_srcdir)/pam_lastlog2/src/pam_lastlog2.sym
 endif