diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2015-11-05 23:22:08 +0100 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2015-11-05 23:22:08 +0100 |
commit | 688d49d5b897ac79a35266428bc43639a5b96169 (patch) | |
tree | 37e201a07e7f97aa6de5ff98f4d91cc3131d024c /i3lock.c | |
parent | 929e541fb78aa167fc52eb684d4fdff8b305b246 (diff) |
fix pam_securetty: set PAM_TTY to getenv("DISPLAY")
fixes #43
Diffstat (limited to 'i3lock.c')
-rw-r--r-- | i3lock.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 |