From 66b90d26cfd555b2aa5fef67d31e539a70256719 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lo=C3=AFc=20Collignon?= Date: Mon, 26 Jun 2017 16:39:43 +0200 Subject: [PATCH] added the PAM's module stub. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Idc8470327d9eac2bad534cdfd4b58e8dc6e5ba6e Signed-off-by: Loïc Collignon --- pam/CMakeLists.txt | 12 +++++++++++- pam/agl-identity-usbstick-pam.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 pam/agl-identity-usbstick-pam.c diff --git a/pam/CMakeLists.txt b/pam/CMakeLists.txt index 3953704..5d2de63 100644 --- a/pam/CMakeLists.txt +++ b/pam/CMakeLists.txt @@ -1 +1,11 @@ -add_library(agl-identity-usbstick-pam SHARED ) \ No newline at end of file + +# Add PAM dependency +# FIXME: Require PAM, but it's seems there is no find_package. +set(PAM_INCLUDE_DIR "/usr/include/") +set(PAM_LIB "/lib64/libpam.so.0") +include_directories(${PAM_INCLUDE_DIR}) + +# Add the target +add_library(agl-identity-usbstick-pam SHARED agl-identity-usbstick-pam.c) +target_link_libraries(agl-identity-usbstick-pam ${PAM_LIB}) +set_property(TARGET agl-identity-usbstick-pam PROPERTY POSITION_IDENPENDENT_CODE ON) diff --git a/pam/agl-identity-usbstick-pam.c b/pam/agl-identity-usbstick-pam.c new file mode 100644 index 0000000..74b3051 --- /dev/null +++ b/pam/agl-identity-usbstick-pam.c @@ -0,0 +1,36 @@ +#define PAM_SM_AUTH +#define PAM_SM_ACCOUNT +#define PAM_SM_SESSION +#define PAM_SM_PASSWORD +#include + +PAM_EXTERN int pam_sm_authenticate(pam_handle_t* pamh, int flags, int argc, const char** argv) +{ + return PAM_SUCCESS; +} + +PAM_EXTERN int pam_sm_setcred(pam_handle_t* pamh, int flags, int argc, const char** argv) +{ + return PAM_SUCCESS; +} + +PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t* pamh, int flags, int argc, const char** argv) +{ + return PAM_SUCCESS; +} + +PAM_EXTERN int pam_sm_open_session(pam_handle_t* pamh, int flags, int argc, const char** argv) +{ + return PAM_SUCCESS; +} + +PAM_EXTERN int pam_sm_close_session(pam_handle_t* pamh, int flags, int argc, const char** argv) +{ + return PAM_SUCCESS; +} + +PAM_EXTERN int pam_sm_chauthtok(pam_handle_t* pamh, int flags, int argc, const char** argv) +{ + return PAM_SUCCESS; +} + -- 2.16.6