summaryrefslogtreecommitdiff
path: root/pam.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-18 09:07:17 -0500
committerGitHub <noreply@github.com>2019-01-18 09:07:17 -0500
commit52eeb9fc1e145a121fdbdaab56446ada26367903 (patch)
treeb662ed20b7c2a86eeb54d9a63b426959fdca9973 /pam.c
parent63fb6c0d963a5a9e6a07a11bf9c4c7e1e8d7dcfc (diff)
parent648b0ccd64c45f6a37c8b6c49a39416a78230a2f (diff)
Merge pull request #24 from c-edw/feature/AbortSUIDWithPAM
Log error and exit if swaylock is suid with PAM backend.
Diffstat (limited to 'pam.c')
-rw-r--r--pam.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/pam.c b/pam.c
index 0c21536..a603bd8 100644
--- a/pam.c
+++ b/pam.c
@@ -11,7 +11,13 @@
static char *pw_buf = NULL;
-void initialize_pw_backend(void) {
+void initialize_pw_backend(int argc, char **argv) {
+ if (getuid() != geteuid() || getgid() != getegid()) {
+ swaylock_log(LOG_ERROR,
+ "swaylock is setuid, but was compiled with the PAM"
+ " backend. Run 'chmod a-s %s' to fix. Aborting.", argv[0]);
+ exit(EXIT_FAILURE);
+ }
if (!spawn_comm_child()) {
exit(EXIT_FAILURE);
}