summaryrefslogtreecommitdiff
path: root/pam.c
diff options
context:
space:
mode:
authorConnor E <38229097+c-edw@users.noreply.github.com>2019-01-18 12:56:00 +0000
committerConnor E <38229097+c-edw@users.noreply.github.com>2019-01-18 12:56:00 +0000
commitccefa54bb7d00f1ea923f283434b6af86e27708d (patch)
treea51906c4cba810668376dd28e33dd58e6cbdca2e /pam.c
parentaf03502384c2c8aa5c93f977a6dcd9df99af5cb3 (diff)
Log error and exit if swaylock is suid with PAM backend.
Diffstat (limited to 'pam.c')
-rw-r--r--pam.c5
1 files changed, 5 insertions, 0 deletions
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);
}