summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorAlexey Bychko <abychko@gmail.com>2020-02-25 17:59:49 +0700
committerOleksandr Byelkin <sanja@mariadb.com>2020-02-25 18:52:27 +0100
commit42b29d41335d2f6991b8c9f110fe1e1476764ace (patch)
tree432e98d30a1e915c587e85a0f89b21b0a56bad4c /plugin
parent4618c974e4b467624d38bb256c2993afb4ac93b1 (diff)
downloadmariadb-git-42b29d41335d2f6991b8c9f110fe1e1476764ace.tar.gz
MENT-645 Undefined symbols for architecture x86_64: _pam_syslog
added cmake checks for pam_ext.h and pam_appl.h headers added check for pam_syslog() added pam_syslog() if doesn't exist all cmake checks performed from inside the plugin
Diffstat (limited to 'plugin')
-rw-r--r--plugin/auth_pam/CMakeLists.txt14
-rw-r--r--plugin/auth_pam/mapper/pam_user_map.c30
2 files changed, 38 insertions, 6 deletions
diff --git a/plugin/auth_pam/CMakeLists.txt b/plugin/auth_pam/CMakeLists.txt
index 0efb0b07feb..c826b422240 100644
--- a/plugin/auth_pam/CMakeLists.txt
+++ b/plugin/auth_pam/CMakeLists.txt
@@ -1,10 +1,24 @@
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckFunctionExists)
+CHECK_INCLUDE_FILES (security/pam_ext.h HAVE_PAM_EXT_H)
CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H)
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
+SET(CMAKE_REQUIRED_LIBRARIES pam)
+CHECK_FUNCTION_EXISTS(pam_syslog HAVE_PAM_SYSLOG)
+SET(CMAKE_REQUIRED_LIBRARIES)
+
+IF(HAVE_PAM_SYSLOG)
+ ADD_DEFINITIONS(-DHAVE_PAM_SYSLOG)
+ENDIF()
+
+IF(HAVE_PAM_EXT_H)
+ ADD_DEFINITIONS(-DHAVE_PAM_EXT_H)
+ENDIF()
+
IF(HAVE_PAM_APPL_H)
+ ADD_DEFINITIONS(-DHAVE_PAM_APPL_H)
IF(HAVE_STRNDUP)
ADD_DEFINITIONS(-DHAVE_STRNDUP)
ENDIF(HAVE_STRNDUP)
diff --git a/plugin/auth_pam/mapper/pam_user_map.c b/plugin/auth_pam/mapper/pam_user_map.c
index e1d11acabb9..9d7ed53f8b1 100644
--- a/plugin/auth_pam/mapper/pam_user_map.c
+++ b/plugin/auth_pam/mapper/pam_user_map.c
@@ -2,7 +2,7 @@
Pam module to change user names arbitrarily in the pam stack.
Compile as
-
+
gcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so
Install as appropriate (for example, in /lib/security/).
@@ -39,14 +39,36 @@ and usually end up in /var/log/secure file.
#include <grp.h>
#include <pwd.h>
+#ifdef HAVE_PAM_EXT_H
#include <security/pam_ext.h>
+#endif
+
+#ifdef HAVE_PAM_APPL_H
+#include <unistd.h>
+#include <security/pam_appl.h>
+#endif
+
#include <security/pam_modules.h>
+#ifndef HAVE_PAM_SYSLOG
+#include <stdarg.h>
+static void
+pam_syslog (const pam_handle_t *pamh, int priority,
+ const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ vsyslog (priority, fmt, args);
+ va_end (args);
+}
+#endif
+
#define FILENAME "/etc/security/user_map.conf"
#define skip(what) while (*s && (what)) s++
+#define SYSLOG_DEBUG if (mode_debug) pam_syslog
#define GROUP_BUFFER_SIZE 100
-
+static const char debug_keyword[]= "debug";
static int populate_user_groups(const char *user, gid_t **groups)
{
@@ -128,10 +150,6 @@ static void print_groups(pam_handle_t *pamh, const gid_t *user_groups, int ng)
ng, (ng == 1) ? "group" : "groups", buf+1);
}
-
-static const char debug_keyword[]= "debug";
-#define SYSLOG_DEBUG if (mode_debug) pam_syslog
-
int pam_sm_authenticate(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{