build pam test module as a part of the build
and install in mysql-test/suite/plugins/pam so that it could be manually copied into /etc if needed
This commit is contained in:
parent
9c74cc4df7
commit
a07c10f53f
@ -12,6 +12,7 @@ IF(HAVE_PAM_APPL_H)
|
|||||||
ADD_DEFINITIONS(-D_GNU_SOURCE)
|
ADD_DEFINITIONS(-D_GNU_SOURCE)
|
||||||
MYSQL_ADD_PLUGIN(auth_pam_v1 auth_pam_v1.c LINK_LIBRARIES pam MODULE_ONLY)
|
MYSQL_ADD_PLUGIN(auth_pam_v1 auth_pam_v1.c LINK_LIBRARIES pam MODULE_ONLY)
|
||||||
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam dl MODULE_ONLY)
|
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam dl MODULE_ONLY)
|
||||||
|
IF (TARGET auth_pam)
|
||||||
MYSQL_ADD_EXECUTABLE(auth_pam_tool auth_pam_tool.c DESTINATION ${INSTALL_PLUGINDIR}/auth_pam_tool_dir COMPONENT Server)
|
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)
|
TARGET_LINK_LIBRARIES(auth_pam_tool pam)
|
||||||
INSTALL(CODE "EXECUTE_PROCESS(
|
INSTALL(CODE "EXECUTE_PROCESS(
|
||||||
@ -19,4 +20,8 @@ IF(HAVE_PAM_APPL_H)
|
|||||||
COMMAND chmod u=rwxs,g=rx,o=rx auth_pam_tool_dir/auth_pam_tool
|
COMMAND chmod u=rwxs,g=rx,o=rx auth_pam_tool_dir/auth_pam_tool
|
||||||
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}/)"
|
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}/)"
|
||||||
COMPONENT Server)
|
COMPONENT Server)
|
||||||
|
ENDIF()
|
||||||
|
IF(TARGET auth_pam OR TARGET auth_pam_v1)
|
||||||
|
ADD_SUBDIRECTORY(testing)
|
||||||
|
ENDIF()
|
||||||
ENDIF(HAVE_PAM_APPL_H)
|
ENDIF(HAVE_PAM_APPL_H)
|
||||||
|
9
plugin/auth_pam/testing/CMakeLists.txt
Normal file
9
plugin/auth_pam/testing/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# gcc pam_mariadb_mtr.c -shared -lpam -fPIC -o pam_mariadb_mtr.so
|
||||||
|
|
||||||
|
ADD_LIBRARY(pam_mariadb_mtr MODULE pam_mariadb_mtr.c)
|
||||||
|
SET_TARGET_PROPERTIES (pam_mariadb_mtr PROPERTIES PREFIX "")
|
||||||
|
TARGET_LINK_LIBRARIES(pam_mariadb_mtr pam)
|
||||||
|
|
||||||
|
SET(dest DESTINATION "${INSTALL_MYSQLTESTDIR}/suite/plugins/pam" COMPONENT Test)
|
||||||
|
INSTALL(TARGETS pam_mariadb_mtr ${dest})
|
||||||
|
INSTALL(FILES mariadb_mtr.conf RENAME mariadb_mtr ${dest})
|
4
plugin/auth_pam/testing/mariadb_mtr.conf
Normal file
4
plugin/auth_pam/testing/mariadb_mtr.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Put it in /etc/pam.d/mariadb_mtr
|
||||||
|
|
||||||
|
auth required pam_mariadb_mtr.so pam_test
|
||||||
|
account required pam_permit.so
|
@ -1,19 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
This code is in the public domain and has no copyright.
|
This code is in the public domain and has no copyright.
|
||||||
|
|
||||||
Pam module to test pam authentication plugin. Used in pam.test.
|
Pam module to test pam authentication plugin. Used in pam tests.
|
||||||
Linux only.
|
Linux only.
|
||||||
|
|
||||||
Compile as
|
|
||||||
|
|
||||||
gcc pam_mariadb_mtr.c -shared -lpam -fPIC -o pam_mariadb_mtr.so
|
|
||||||
|
|
||||||
Install as appropriate (for example, in /lib/security/).
|
Install as appropriate (for example, in /lib/security/).
|
||||||
Create /etc/pam.d/mariadb_mtr with
|
see also mariadb_mtr.conf
|
||||||
=========================================================
|
|
||||||
auth required pam_mariadb_mtr.so pam_test
|
|
||||||
account required pam_permit.so
|
|
||||||
=========================================================
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -59,7 +51,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
|
|||||||
if (strcmp(r1, "crash pam module") == 0 && atoi(r2) == 616)
|
if (strcmp(r1, "crash pam module") == 0 && atoi(r2) == 616)
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
if (strlen(r1) == atoi(r2) % 100)
|
if (strlen(r1) == (uint)atoi(r2) % 100)
|
||||||
retval = PAM_SUCCESS;
|
retval = PAM_SUCCESS;
|
||||||
else
|
else
|
||||||
retval = PAM_AUTH_ERR;
|
retval = PAM_AUTH_ERR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user