From ccefa54bb7d00f1ea923f283434b6af86e27708d Mon Sep 17 00:00:00 2001 From: Connor E <38229097+c-edw@users.noreply.github.com> Date: Fri, 18 Jan 2019 12:56:00 +0000 Subject: [PATCH] Log error and exit if swaylock is suid with PAM backend. --- pam.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pam.c b/pam.c index 0c21536..a192f84 100644 --- a/pam.c +++ b/pam.c @@ -12,6 +12,11 @@ static char *pw_buf = NULL; void initialize_pw_backend(void) { + if (getuid() != geteuid() || getgid() != getegid()) { + swaylock_log(LOG_ERROR, + "swaylock has suid but doesn't require it with PAM backend"); + exit(EXIT_FAILURE); + } if (!spawn_comm_child()) { exit(EXIT_FAILURE); }