From fa2a875e339a3f554ea2fb2c0a8bbc7098b01e71 Mon Sep 17 00:00:00 2001 From: Aaron Blasko Date: Sat, 2 Mar 2024 00:49:44 +0100 Subject: [PATCH] Adding a pam configuration file (#115) --- CMakeLists.txt | 5 +++++ pam/hyprlock | 5 +++++ src/core/Password.cpp | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 pam/hyprlock diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d7327b..890882f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ include_directories( "protocols/" ) +include(GNUInstallDirs) + # configure set(CMAKE_CXX_STANDARD 23) add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value @@ -80,3 +82,6 @@ protocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml" "linux-dmabuf-unst # Installation install(TARGETS hyprlock) + +install(FILES "pam/hyprlock" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d") + diff --git a/pam/hyprlock b/pam/hyprlock new file mode 100644 index 0000000..247d48d --- /dev/null +++ b/pam/hyprlock @@ -0,0 +1,5 @@ +# PAM configuration file for hyprlock +# the 'login' configuration file (see /etc/pam.d/login) + +auth include login + diff --git a/src/core/Password.cpp b/src/core/Password.cpp index cdc7b10..ddcd52c 100644 --- a/src/core/Password.cpp +++ b/src/core/Password.cpp @@ -30,7 +30,7 @@ std::shared_ptr CPassword::verify(const std::str const pam_conv localConv = {conv, NULL}; pam_handle_t* handle = NULL; - int ret = pam_start("su", getlogin(), &localConv, &handle); + int ret = pam_start("hyprlock", getlogin(), &localConv, &handle); if (ret != PAM_SUCCESS) { result->success = false; @@ -63,4 +63,4 @@ std::shared_ptr CPassword::verify(const std::str }).detach(); return result; -} \ No newline at end of file +}