From d134d39efc52fd969141cb7ec8994bff10a29a01 Mon Sep 17 00:00:00 2001 From: alba4k Date: Fri, 1 Mar 2024 23:16:52 +0100 Subject: [PATCH 1/2] added a pam configuration file --- CMakeLists.txt | 2 ++ pam/hyprlock | 5 +++++ src/core/Password.cpp | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 pam/hyprlock diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d7327b7..558dee6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,3 +80,5 @@ protocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml" "linux-dmabuf-unst # Installation install(TARGETS hyprlock) + +install(FILES "pam/hyprlock" DESTINATION "/etc/pam.d") diff --git a/pam/hyprlock b/pam/hyprlock new file mode 100644 index 00000000..247d48da --- /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 cdc7b100..ddcd52c0 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 +} From ced73af293d94e33d72dfd92249c6d890b19e31e Mon Sep 17 00:00:00 2001 From: alba4k Date: Sat, 2 Mar 2024 00:41:45 +0100 Subject: [PATCH 2/2] using GNU sysconfdir for pam configurations --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 558dee6d..890882f7 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 @@ -81,4 +83,5 @@ protocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml" "linux-dmabuf-unst # Installation install(TARGETS hyprlock) -install(FILES "pam/hyprlock" DESTINATION "/etc/pam.d") +install(FILES "pam/hyprlock" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d") +