2022-01-05 15:37:47 +01:00
|
|
|
IF(WIN32)
|
|
|
|
RETURN()
|
|
|
|
ENDIF()
|
|
|
|
|
2012-02-06 16:26:12 +01:00
|
|
|
INCLUDE (CheckIncludeFiles)
|
2012-02-23 07:50:43 +01:00
|
|
|
INCLUDE (CheckFunctionExists)
|
2012-02-06 16:26:12 +01:00
|
|
|
|
2020-02-25 11:59:49 +01:00
|
|
|
CHECK_INCLUDE_FILES (security/pam_ext.h HAVE_PAM_EXT_H)
|
2012-02-06 16:26:12 +01:00
|
|
|
CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H)
|
2012-02-23 07:50:43 +01:00
|
|
|
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
|
2021-03-19 00:56:10 +01:00
|
|
|
CHECK_FUNCTION_EXISTS (getgrouplist HAVE_GETGROUPLIST)
|
2012-02-06 16:26:12 +01:00
|
|
|
|
2020-10-23 12:18:39 +02:00
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2021-03-19 00:56:10 +01:00
|
|
|
# Check whether getgrouplist uses gtid_t for second and third arguments.
|
2020-10-23 12:18:39 +02:00
|
|
|
SET(CMAKE_REQUIRED_FLAGS -Werror)
|
|
|
|
CHECK_C_SOURCE_COMPILES(
|
|
|
|
"
|
|
|
|
#include <grp.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
int main() {
|
2020-10-29 16:36:49 +01:00
|
|
|
char *arg_1= 0;
|
|
|
|
gid_t arg_2=0, arg_3;
|
2020-10-23 12:18:39 +02:00
|
|
|
int arg_4;
|
2020-10-23 14:15:22 +02:00
|
|
|
(void)getgrouplist(arg_1,arg_2,&arg_3,&arg_4);
|
2020-10-23 12:18:39 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
"
|
|
|
|
HAVE_POSIX_GETGROUPLIST
|
|
|
|
)
|
|
|
|
SET(CMAKE_REQUIRED_FLAGS)
|
|
|
|
|
2020-02-25 11:59:49 +01:00
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES pam)
|
|
|
|
CHECK_FUNCTION_EXISTS(pam_syslog HAVE_PAM_SYSLOG)
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES)
|
|
|
|
|
2021-03-19 00:56:10 +01:00
|
|
|
IF(HAVE_PAM_APPL_H AND HAVE_GETGROUPLIST)
|
2020-04-23 12:25:15 +02:00
|
|
|
FIND_LIBRARY(PAM_LIBRARY pam) # for srpm build-depends detection
|
2018-07-03 13:49:34 +02:00
|
|
|
ADD_DEFINITIONS(-D_GNU_SOURCE)
|
|
|
|
MYSQL_ADD_PLUGIN(auth_pam_v1 auth_pam_v1.c LINK_LIBRARIES pam MODULE_ONLY)
|
2020-10-29 12:38:38 +01:00
|
|
|
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam ${CMAKE_DL_LIBS} MODULE_ONLY)
|
2019-06-30 18:06:49 +02:00
|
|
|
IF (TARGET auth_pam)
|
|
|
|
MYSQL_ADD_EXECUTABLE(auth_pam_tool auth_pam_tool.c DESTINATION ${INSTALL_PLUGINDIR}/auth_pam_tool_dir COMPONENT Server)
|
|
|
|
TARGET_LINK_LIBRARIES(auth_pam_tool pam)
|
2021-08-24 11:03:02 +02:00
|
|
|
SET(CPACK_RPM_server_USER_FILELIST ${CPACK_RPM_server_USER_FILELIST}
|
2021-08-30 15:35:35 +02:00
|
|
|
"%attr(700,-,-) ${INSTALL_PLUGINDIRABS}/auth_pam_tool_dir"
|
|
|
|
"%attr(4755,-,-) ${INSTALL_PLUGINDIRABS}/auth_pam_tool_dir/auth_pam_tool")
|
2021-08-24 11:03:02 +02:00
|
|
|
SET(CPACK_RPM_server_USER_FILELIST ${CPACK_RPM_server_USER_FILELIST} PARENT_SCOPE)
|
2019-06-30 18:06:49 +02:00
|
|
|
ENDIF()
|
|
|
|
IF(TARGET auth_pam OR TARGET auth_pam_v1)
|
|
|
|
ADD_SUBDIRECTORY(testing)
|
2020-01-20 15:10:39 +01:00
|
|
|
ADD_LIBRARY(pam_user_map MODULE mapper/pam_user_map.c)
|
|
|
|
TARGET_LINK_LIBRARIES(pam_user_map pam)
|
|
|
|
SET_TARGET_PROPERTIES (pam_user_map PROPERTIES PREFIX "")
|
|
|
|
IF(INSTALL_PAMDIR)
|
|
|
|
INSTALL(TARGETS pam_user_map DESTINATION ${INSTALL_PAMDIR} COMPONENT Server)
|
2020-04-23 12:25:15 +02:00
|
|
|
INSTALL(FILES mapper/user_map.conf DESTINATION ${INSTALL_PAMDATADIR} COMPONENT Server)
|
2021-08-24 11:03:02 +02:00
|
|
|
SET(CPACK_RPM_server_USER_FILELIST ${CPACK_RPM_server_USER_FILELIST} "%config(noreplace) ${INSTALL_PAMDATADIRABS}/*" PARENT_SCOPE)
|
2020-01-20 15:10:39 +01:00
|
|
|
ENDIF()
|
2019-06-30 18:06:49 +02:00
|
|
|
ENDIF()
|
2021-03-19 00:56:10 +01:00
|
|
|
ENDIF()
|
2012-02-06 16:26:12 +01:00
|
|
|
|
2020-10-23 12:18:39 +02:00
|
|
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/config_auth_pam.h)
|