From e528233e4474aefc668908e5d4bb595c7868a8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E6=B6=9B?= Date: Tue, 21 Jul 2026 14:09:15 +0800 Subject: [PATCH] Fix pam_get_user symbol error The systemd print the following error user linux 7.0 > Jul 21 05:46:45 host (systemd)[1696]: PAM unable to > dlopen(/usr/local/lib/security/pam_usernet.so): > /usr/local/lib/security/pam_usernet.so: undefined symbol: pam_get_user --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7e27e0..30068ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ if(NOT NLINLINE_INCLUDE) message(FATAL_ERROR "*** required nlinline.h include file not found.\nInstall nlinline: https://github.com/virtualsquare/nlinline") endif() +find_library(PAM_LIBRARY NAMES pam REQUIRED) + if(LIBSECURITYDIR) set(CMAKE_INSTALL_PAMDIR ${LIBSECURITYDIR}) else() @@ -34,6 +36,10 @@ add_library(pam_groupnet SHARED pam_groupnet.c pam_net_checkgroup.c) set_target_properties(pam_groupnet PROPERTIES PREFIX "") target_compile_definitions(pam_groupnet PUBLIC PAM_GROUPNET) +target_link_libraries(pam_newnet PRIVATE ${PAM_LIBRARY}) +target_link_libraries(pam_usernet PRIVATE ${PAM_LIBRARY}) +target_link_libraries(pam_groupnet PRIVATE ${PAM_LIBRARY}) + install(TARGETS pam_newnet pam_usernet pam_groupnet DESTINATION ${CMAKE_INSTALL_PAMDIR})