i3lock-color

The world's most popular non-default computer lockscreen.
Index Commits Files Refs README LICENSE
commit 688d49d5b897ac79a35266428bc43639a5b96169
parent 929e541fb78aa167fc52eb684d4fdff8b305b246
Author: Michael Stapelberg <michael@stapelberg.de>
Date:   Thu,  5 Nov 2015 23:22:08 +0100

fix pam_securetty: set PAM_TTY to getenv("DISPLAY")

fixes #43

Diffstat:
Mi3lock.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/i3lock.c b/i3lock.c
@@ -834,8 +834,10 @@ int main(int argc, char *argv[]) {
     srand(time(NULL));
 
     /* Initialize PAM */
-    ret = pam_start("i3lock", username, &conv, &pam_handle);
-    if (ret != PAM_SUCCESS)
+    if ((ret = pam_start("i3lock", username, &conv, &pam_handle)) != PAM_SUCCESS)
+        errx(EXIT_FAILURE, "PAM: %s", pam_strerror(pam_handle, ret));
+
+    if ((ret = pam_set_item(pam_handle, PAM_TTY, getenv("DISPLAY"))) != PAM_SUCCESS)
         errx(EXIT_FAILURE, "PAM: %s", pam_strerror(pam_handle, ret));
 
 /* Using mlock() as non-super-user seems only possible in Linux. Users of other