1
0
mirror of https://github.com/falk-werner/webfused synced 2024-10-27 20:44:08 +00:00

added dependency to linux-pam

This commit is contained in:
Falk Werner 2020-03-19 18:33:16 +01:00
parent 35e63bb182
commit b53e002de0
5 changed files with 48 additions and 1 deletions

View File

@ -25,6 +25,7 @@ addons:
- python3-wheel - python3-wheel
- ninja-build - ninja-build
- libconfig-dev - libconfig-dev
- libpam0g-dev
- valgrind - valgrind
env: env:

View File

@ -3,6 +3,8 @@ project(webfused VERSION 0.1.0 DESCRIPTION "Webfuse daemon")
option(WITHOUT_TESTS "disable unit tests" OFF) option(WITHOUT_TESTS "disable unit tests" OFF)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
@ -14,6 +16,7 @@ pkg_check_modules(UUID REQUIRED uuid)
pkg_check_modules(LIBCONFIG REQUIRED libconfig) pkg_check_modules(LIBCONFIG REQUIRED libconfig)
pkg_check_modules(OPENSSL REQUIRED openssl) pkg_check_modules(OPENSSL REQUIRED openssl)
pkg_check_modules(WEBFUSE REQUIRED libwebfuse-adapter) pkg_check_modules(WEBFUSE REQUIRED libwebfuse-adapter)
find_package(Pam REQUIRED)
add_definitions(-D_FILE_OFFSET_BITS=64) add_definitions(-D_FILE_OFFSET_BITS=64)
@ -33,7 +36,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(C_WARNINGS -Wall -Wextra) set(C_WARNINGS -Wall -Wextra)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(coverage) include(coverage)
add_library(userdb STATIC add_library(userdb STATIC
@ -76,6 +78,7 @@ target_link_libraries(webfused PUBLIC
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${WEBFUSE_LIBRARIES} ${WEBFUSE_LIBRARIES}
${UUID_LIBRARIES} ${UUID_LIBRARIES}
${PAM_LIBRARIES}
) )
target_compile_options(webfused PUBLIC ${OPENSSL_CFLAGS_OTHER}) target_compile_options(webfused PUBLIC ${OPENSSL_CFLAGS_OTHER})
@ -130,6 +133,7 @@ add_executable(alltests
test/test_stderr_logger.cc test/test_stderr_logger.cc
test/test_syslog_logger.cc test/test_syslog_logger.cc
test/test_daemon.cc test/test_daemon.cc
test/test_pam.cc
) )
target_include_directories(alltests PRIVATE target_include_directories(alltests PRIVATE
@ -165,6 +169,7 @@ target_link_libraries(alltests PRIVATE
${LIBCONFIG_LIBRARIES} ${LIBCONFIG_LIBRARIES}
${WEBFUSE_LIBRARIES} ${WEBFUSE_LIBRARIES}
${UUID_LIBRARIES} ${UUID_LIBRARIES}
${PAM_LIBRARIES}
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${GMOCK_LIBRARIES} ${GMOCK_LIBRARIES}
${GTEST_LIBRARIES} ${GTEST_LIBRARIES}

View File

@ -180,6 +180,7 @@ switch to *user* and *group* provided in config file.
- [jansson](https://github.com/akheron/jansson) - [jansson](https://github.com/akheron/jansson)
- [openssl](https://www.openssl.org/) - [openssl](https://www.openssl.org/)
- [libconfig](https://hyperrealm.github.io/libconfig/) - [libconfig](https://hyperrealm.github.io/libconfig/)
- [linux-pam](http://www.linux-pam.org/)
- [Google Test](https://github.com/google/googletest) *(Test only)* - [Google Test](https://github.com/google/googletest) *(Test only)*
### Installing dependencies ### Installing dependencies
@ -240,6 +241,11 @@ To install libfuse, meson is needed. Please refer to [meson quick guide](https:/
sudo apt update sudo apt update
sudo apt install libconfig-dev sudo apt install libconfig-dev
#### linux-pam
sudo apt update
sudo apt install libpam0g-dev
#### GoogleTest #### GoogleTest
Installation of GoogleTest is optional webfuse library, but required to compile tests. Installation of GoogleTest is optional webfuse library, but required to compile tests.

22
cmake/FindPam.cmake Normal file
View File

@ -0,0 +1,22 @@
find_package(PkgConfig)
pkg_check_modules(PC_PAM QUIET pam)
set(PAM_DEFINITIONS ${PC_PAM_CFLAGS_OTHER})
find_path(PAM_INCLUDE_DIR security/pam_appl.h
HINTS ${PC_PAM_INCLUDEDIR} ${PC_PAM_INCLUDE_DIRS}
)
find_library(PAM_LIBRARY NAMES pam
HINTS ${PC_PAM_LIBDIR} ${PC_PAM_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Pam DEFAULT_MSG
PAM_LIBRARY PAM_INCLUDE_DIR
)
mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY)
set(PAM_LIBRARIES ${PAM_LIBRARY})
set(PAM_INCLUDE_DIRS ${PAM_INCLUDE_DIR})

13
test/test_pam.cc Normal file
View File

@ -0,0 +1,13 @@
#include <security/pam_appl.h>
#include <gtest/gtest.h>
TEST(pam, start)
{
pam_handle_t * handle = nullptr;
struct pam_conv conv = { nullptr, nullptr };
int rc = pam_start("test", nullptr, &conv, &handle);
if (PAM_SUCCESS == rc)
{
pam_end(handle, 0);
}
}