From b166928baca9e534d906c0240e48c5b8fb4c7f25 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 22 Jul 2007 12:13:07 +0000 Subject: [PATCH] Some versions of pam_lastlog have a bug that will cause a crash if PAM_TTY is not set so if there is no tty, set PAM_TTY to the empty string. --- auth/pam.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/auth/pam.c b/auth/pam.c index 2ecf2f7a1..d6f5914f8 100644 --- a/auth/pam.c +++ b/auth/pam.c @@ -94,7 +94,14 @@ pam_init(pw, promptp, auth) log_error(USE_ERRNO|NO_EXIT|NO_MAIL, "unable to initialize PAM"); return(AUTH_FATAL); } - if (strcmp(user_tty, "unknown")) + /* + * Some versions of pam_lastlog have a bug that + * will cause a crash if PAM_TTY is not set so if + * there is no tty, set PAM_TTY to the empty string. + */ + if (strcmp(user_tty, "unknown") == 0) + (void) pam_set_item(pamh, PAM_TTY, ""); + else (void) pam_set_item(pamh, PAM_TTY, user_tty); return(AUTH_SUCCESS); -- 2.40.0