]> git.sur5r.net Git - i3/i3lock/commitdiff
fix pam_securetty: set PAM_TTY to getenv("DISPLAY")
authorMichael Stapelberg <michael@stapelberg.de>
Thu, 5 Nov 2015 22:22:08 +0000 (23:22 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Thu, 5 Nov 2015 22:22:08 +0000 (23:22 +0100)
fixes #43

i3lock.c

index a7b54f5823a86f0e0b84f90083d82cacab53a671..3a106ce935a0f6fe268a54dd871a2cf91d914d44 100644 (file)
--- 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