From 777290b4692c45f4854f9c917da18783c98010a0 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 22 Jun 2011 00:18:17 +0000 Subject: [PATCH] Detect and enable PAM authentication support git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4513 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- CMakeLists.txt | 15 +++++++++++++++ common/rfb/CMakeLists.txt | 6 ++++++ config.h.cmake.in | 1 + 3 files changed, 22 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f9d9578..fb4e7135 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -253,6 +253,21 @@ if(ENABLE_GNUTLS) endif() endif() +# Check for PAM library +option(ENABLE_PAM "Enable PAM authentication support" ON) +if(ENABLE_PAM) + check_include_files(security/pam_appl.h HAVE_PAM_H) + set(CMAKE_REQUIRED_LIBRARIES -lpam) + check_function_exists(pam_start HAVE_PAM_START) + set(CMAKE_REQUIRED_LIBRARIES) + if(HAVE_PAM_H AND HAVE_PAM_START) + set(PAM_LIBS pam) + else() + set(ENABLE_PAM 0) + endif() +endif() +set(HAVE_PAM ${ENABLE_PAM}) + # Check for socket functions if(WIN32) set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h ws2tcpip.h) diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 4ca93499..eddbaea4 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -72,6 +72,12 @@ endif(WIN32) set(RFB_LIBRARIES ${JPEG_LIBRARIES} os) +if(HAVE_PAM) + set(RFB_SOURCES ${RFB_SOURCES} UnixPasswordValidator.cxx + UnixPasswordValidator.h pam.c pam.h) + set(RFB_LIBRARIES ${RFB_LIBRARIES} ${PAM_LIBS}) +endif() + if(GNUTLS_FOUND) set(RFB_SOURCES ${RFB_SOURCES} diff --git a/config.h.cmake.in b/config.h.cmake.in index bce755fe..5f7a4c71 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -17,6 +17,7 @@ #cmakedefine HAVE_FLTK_FULLSCREEN #cmakedefine HAVE_FLTK_CURSOR #cmakedefine ENABLE_NLS 1 +#cmakedefine HAVE_PAM /* MS Visual Studio 2008 and newer doesn't know ssize_t */ #if defined(HAVE_GNUTLS) && defined(WIN32) && !defined(__MINGW32__) -- 2.39.5