[MDEV-21817] Undefined symbols for architecture x86_64: _pam_syslog Created: 2020-02-17  Updated: 2020-02-26  Resolved: 2020-02-26

Status: Closed
Project: MariaDB Server
Component/s: Plugin - pam
Affects Version/s: 10.2, 10.3, 10.4
Fix Version/s: 10.2.32, 10.3.23, 10.4.13

Type: Bug Priority: Blocker
Reporter: Alexey Bychko (Inactive) Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
is blocked by MDEV-21592 Build broken on OpenPAM systems Closed

 Description   

MacOS linker failed with following:

[ 92%] Linking C shared module pam_user_map.so
Undefined symbols for architecture x86_64:
  "_pam_syslog", referenced from:
      _pam_sm_authenticate in pam_user_map.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [plugin/auth_pam/pam_user_map.so] Error 1
make[1]: *** [plugin/auth_pam/CMakeFiles/pam_user_map.dir/all] Error 2
make: *** [all] Error 2

tried to build with following patch to solve MDEV-21592

diff --git a/plugin/auth_pam/mapper/pam_user_map.c b/plugin/auth_pam/mapper/pam_user_map.c
index e1d11acabb9..83a7626b427 100644
--- a/plugin/auth_pam/mapper/pam_user_map.c
+++ b/plugin/auth_pam/mapper/pam_user_map.c
@@ -39,7 +39,11 @@ and usually end up in /var/log/secure file.
 #include <grp.h>
 #include <pwd.h>
 
+#if defined (__APPLE__) || defined (__FreeBSD__)
+#include <unistd.h>
+#include <security/pam_appl.h>
+#else
 #include <security/pam_ext.h>
+#endif
 #include <security/pam_modules.h>
 
 #define FILENAME "/etc/security/user_map.conf"



 Comments   
Comment by Sergei Golubchik [ 2020-02-21 ]

A good fix could be to test for pam_syslog in CMakeLists.txt and not use if it's not available.
A simple fix would be to extend your patch above to something like

+#if defined (__APPLE__) || defined (__FreeBSD__)
+#include <unistd.h>
+#include <security/pam_appl.h>
+#define pam_syslog(H, ...)
+#else

Comment by Alexey Bychko (Inactive) [ 2020-02-25 ]

added PR https://github.com/mariadb-corporation/MariaDBEnterprise/pull/22

Comment by Alexey Bychko (Inactive) [ 2020-02-25 ]

there was a bug with cmake pam detection. only library lookup works

Comment by Alexey Bychko (Inactive) [ 2020-02-25 ]

reworked pam symbol check, pushed

Comment by Alexey Bychko (Inactive) [ 2020-02-26 ]

Sanja, please merge

Generated at Thu Feb 08 09:10:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.