Commit graph

10 commits

Author SHA1 Message Date
Maximilian Seidler
05ea55fd9c core: more obvious api around isUnlocked related logic 2026-04-29 19:42:02 +02:00
Maximilian Seidler
927e09fb7d
pam: start conversation right away (#1003)
* Revert "auth: don't start pam conversation before the initial input happens (#409)"

This reverts commit 3bedae4436.

* pam: fix some logic cleanup
2026-04-29 17:35:26 +00:00
Maximilian Seidler
4e4f03cc1d
core: use Hyprutils::CLI (#977)
* core: use Hyprutils::CLI::CLogger

* core: use Hyprutils::CLI::CArgumentParser and validate config exists
2026-03-31 14:56:08 +00:00
Maximilian Seidler
768ade88a8
pam: get username once (#974)
* pam: fix username race by using getpwuid_r instead of getpwuid

getpwuid() returns a pointer into a static buffer shared across all
threads. Any getpw*/getpwent call from another thread — including
those made internally by PAM modules during authentication — will
overwrite it before pam_start() reads pw_name, causing hyprlock to
authenticate as a random system user (root, bin, systemd-network)
or fail with 'user unknown'.

Replace with getpwuid_r(), which writes into a caller-supplied buffer,
and copy pw_name into a std::string before calling pam_start().

* pam: get username once

Instead of retrieving the username via getpwuid_r as in a69f526c95,
get the username once when initializing CPam and save it in a string.
This should be sufficent for making sure there are no problems with the
static buffer returned by getpwuid and is simpler.

* misc: clang-format

---------

Co-authored-by: mcgi5sr2 <mcgi5sr2@gmail.com>
2026-03-23 16:21:13 +00:00
Maximilian Seidler
ee8ee1f9f7
core: move password buffer clearing to handleInput (#708)
Makes more sense than clearing the input buffer in the auth impl.
Also added a check for the password buffer length to reset the fail
color as soon as the password length > 0.
2025-03-17 11:25:51 +00:00
Honkazel
dc6d72158c
core: clang-tidy and comp fixes (#679)
* clang-tidy and comp fixes

* nit changes
2025-02-06 11:36:08 +00:00
Maximilian Seidler
1bfa79eb83
core: move to hyprlang config value wrapper (#667) 2025-01-29 23:10:27 +01:00
Maximilian Seidler
4f964371cc
auth: fixup prompt and fail substitution (#641)
BREAKING:
- Removed $PROMPT variable. Either use $PAMPROMPT or $FPRINTPROMPT.
- Removed $FPRINTMESSAGE. Use $FPRINTPROMPT instead. There is also
  $FPRINTFAIL.
2025-01-12 17:18:18 +00:00
Maximilian Seidler
bf37645daa
auth: assert username (#604) 2024-12-23 20:53:27 +00:00
Maximilian Seidler
a4b0562749
auth: add an interface for different authentication methods (#578)
* auth: add an interface for different authentication methods

* auth: pick inline feedback based on last active implementation

* config: move auth options to auth:<auth_impl>

BREAKING:
- general:pam_module -> auth:pam:module
- general:enable_fingerprint -> auth:fingerprint:enabled
- general:fingerprint_ready_message -> auth:fingerprint:ready_message
- general:fingerprint_present_message ->
auth:fingerprint:present_message

* auth: don't clear password input for fingerprint auth check

* fingerprint: checkAuthenticated when handling verfiy status

* Revert conditionally clearing the password input buffer

Makes sure the input field can show the fail text for fingerprint auth.

* auth: virtual instead of override, remove braces

* pam: join the thread

* auth: remove isAuthenticated and switch to a control flow based unlock

* auth: initialize authentication before aquiring the session lock
2024-12-16 19:58:36 +01:00
Renamed from src/core/Auth.cpp (Browse further)