summaryrefslogtreecommitdiff
path: root/comm.c
AgeCommit message (Collapse)Author
2025-08-09fix missing include for sigactionƁukasz P. Michalik
2025-04-27Ignore SIGUSR1 in the backend child processKenny Levinsen
If a user calls `killall -USR1 swaylock`, they may end up signalling the password backend. As the password backend forked before SIGUSR1 handling was set up, it inherits the default handler and terminates. Set the SIGUSR1 handler to SIG_IGN in the child process. Fixes: https://github.com/swaywm/swaylock/issues/409
2025-03-21comm: assert that password size is positiveSimon Ser
If it's not, we may be reading before the buffer bounds later. (The password buffer size is aligned to the page size.)
2025-03-18Assert that password buffer is NULL-terminatedSimon Ser
read_comm_request() just copies bytes around. handle_conversation() relies on the fact that the password buffer is NULL-terminated. Make sure that's the case.
2025-03-16Reapply "comm: improve robustness"Simon Ser
This reverts commit e0ca5adecd0b0f89f20322c9b410b460e8f73c5b. See 285d0292914b ("comm: improve robustness") for details. Also add EINTR handling.
2025-03-15Revert "comm: improve robustness"Simon Ser
This reverts commit 285d0292914bf6361a1a32ce1561a6d3fb6ebeca. This got accidentally pushed to master.
2025-03-14comm: improve robustnessSimon Ser
swaylock was performing some read() calls with a >1 size and didn't handle partial reads. Fix this by introducing two helpers, read_full() and write_full(), to read/write a complete buffer. read_comm_request() needs to make the difference between EOF at the start of a message vs. in the middle, so needs to return a tri-state.
2025-03-12Better handle subprocess crashesSimon Ser
On my machine EOF doesn't trigger POLLHUP (not sure why), instead read() returns zero. It just prints the following message in a loop: [comm.c:101] Failed to read pw result: Success Better handle this case in read_comm_reply() by making a difference between a failed read() and a failed authentication.
2022-06-15Use mlock for password bufferRobin Ebert
2019-01-17Check password without blockingemersion
2019-01-17Move PAM into a child processemersion