]> source.dussan.org Git - tigervnc.git/commitdiff
Make PAM mandatory
authorPierre Ossman <ossman@cendio.se>
Wed, 11 Jul 2018 13:49:46 +0000 (15:49 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 12 Mar 2020 11:03:32 +0000 (12:03 +0100)
It is present on all UNIX systems anyway, so let's simplify things.
We will need it for more proper session startup anyway.

BUILDING.txt
CMakeLists.txt
common/rfb/CMakeLists.txt
common/rfb/SSecurityPlain.cxx
common/rfb/UnixPasswordValidator.cxx
common/rfb/pam.c
common/rfb/pam.h
config.h.in

index 72aea7659ab6b16b44520323705c5e9116c68ea8..4f3150722e207ada81c0163ed998449046d3eb31 100644 (file)
@@ -32,6 +32,7 @@ Build Requirements (Unix)
 
 -- Non-Mac platforms:
    * X11 development kit
+   * PAM
 
 -- If building Xvnc/libvnc.so:
    * Xorg server source code, 1.7 or never
index f6742e7b277876f0d501e04160551415037eaddb..5776a9fb0afb5e5c05bbd01dfd3e0b5209003233 100644 (file)
@@ -263,8 +263,7 @@ if(ENABLE_GNUTLS)
 endif()
 
 # Check for PAM library
-option(ENABLE_PAM "Enable PAM authentication support" ON)
-if(ENABLE_PAM)
+if(UNIX AND NOT APPLE)
   check_include_files(security/pam_appl.h HAVE_PAM_H)
   set(CMAKE_REQUIRED_LIBRARIES -lpam)
   check_function_exists(pam_start HAVE_PAM_START)
@@ -272,10 +271,9 @@ if(ENABLE_PAM)
   if(HAVE_PAM_H AND HAVE_PAM_START)
     set(PAM_LIBS pam)
   else()
-    set(ENABLE_PAM 0)
+    message(FATAL_ERROR "Could not find PAM development files")
   endif()
 endif()
-set(HAVE_PAM ${ENABLE_PAM})
 
 # Generate config.h and make sure the source finds it
 configure_file(config.h.in config.h)
index 8e532a28c8bcf9dae177773b3313442e90319994..689cdccd2436f0737c838ba15a184c6ea1cbd73c 100644 (file)
@@ -75,7 +75,7 @@ endif(WIN32)
 
 set(RFB_LIBRARIES ${JPEG_LIBRARIES} os rdr Xregion)
 
-if(HAVE_PAM)
+if(UNIX AND NOT APPLE)
   set(RFB_SOURCES ${RFB_SOURCES} UnixPasswordValidator.cxx
     UnixPasswordValidator.h pam.c pam.h)
   set(RFB_LIBRARIES ${RFB_LIBRARIES} ${PAM_LIBS})
index 6f72432ad4be4294eeddbc6287e9cdcae3ecea1b..f577c0d6fa1fc2657ccd16b9e06d23134e15dd10 100644 (file)
 #include <rfb/SConnection.h>
 #include <rfb/Exception.h>
 #include <rdr/InStream.h>
-#ifdef HAVE_PAM
+#if !defined(WIN32) && !defined(__APPLE__)
 #include <rfb/UnixPasswordValidator.h>
 #endif
-#ifdef BUILD_WIN
+#ifdef WIN32
 #include <rfb/WinPasswdValidator.h>
 #endif
 
@@ -62,10 +62,10 @@ bool PasswordValidator::validUser(const char* username)
 
 SSecurityPlain::SSecurityPlain(SConnection* sc) : SSecurity(sc)
 {
-#ifdef HAVE_PAM
-  valid = new UnixPasswordValidator();
-#elif BUILD_WIN
+#ifdef WIN32
   valid = new WinPasswdValidator();
+#elif !defined(__APPLE__)
+  valid = new UnixPasswordValidator();
 #else
   valid = NULL;
 #endif
index d0960794582415c5190fcc89ad64d527ffb7ee1b..ee7bc0dac40f37619720d9ecdcfae4936e0d4275 100644 (file)
@@ -25,9 +25,7 @@
 #include <rfb/Configuration.h>
 #include <rfb/Exception.h>
 #include <rfb/UnixPasswordValidator.h>
-#ifdef HAVE_PAM
 #include <rfb/pam.h>
-#endif
 
 using namespace rfb;
 
@@ -43,10 +41,6 @@ bool UnixPasswordValidator::validateInternal(SConnection * sc,
                                             const char *username,
                                             const char *password)
 {
-#ifdef HAVE_PAM
   CharArray service(strDup(pamService.getData()));
   return do_pam_auth(service.buf, username, password);
-#else
-  throw AuthFailureException("PAM not supported");
-#endif
 }
index cb067fda446e61ead4b70e2daee40aaeb3c64821..f9e5ce747e3e8960a281385ddac768898dbff95b 100644 (file)
 #include <config.h>
 #endif
 
-#ifndef HAVE_PAM
-#error "This source should not be compiled when PAM is unsupported"
-#endif
-
 #include <stdlib.h>
 #include <string.h>
 #include <security/pam_appl.h>
index 2688f21cf39bfbecf96ed008c19137f75d38ddb9..d378d19c05b0cc6aa4bd8516c2d8d4af152f792e 100644 (file)
 #ifndef __RFB_PAM_H__
 #define __RFB_PAM_H__
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef HAVE_PAM
-#error "This header should not be included when PAM is unsupported"
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
index 2d6db9c6c3ef1dcc9c3eefc1e9d1139e6e47871e..b6a9fdffbd2f657d4f880e662c0778756fd98f83 100644 (file)
@@ -4,7 +4,6 @@
 #cmakedefine HAVE_ACTIVE_DESKTOP_H
 #cmakedefine HAVE_ACTIVE_DESKTOP_L
 #cmakedefine ENABLE_NLS 1
-#cmakedefine HAVE_PAM
 
 #cmakedefine DATA_DIR "@DATA_DIR@"
 #cmakedefine LOCALE_DIR "@LOCALE_DIR@"