From: Michael Stapelberg Date: Thu, 5 Nov 2015 22:22:08 +0000 (+0100) Subject: fix pam_securetty: set PAM_TTY to getenv("DISPLAY") X-Git-Tag: 2.8~11 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=688d49d5b897ac79a35266428bc43639a5b96169;p=i3%2Fi3lock fix pam_securetty: set PAM_TTY to getenv("DISPLAY") fixes #43 --- diff --git a/i3lock.c b/i3lock.c index a7b54f5..3a106ce 100644 --- 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