From: Todd C. Miller Date: Sun, 22 Jul 2007 12:13:07 +0000 (+0000) Subject: Some versions of pam_lastlog have a bug that will cause a crash if X-Git-Tag: SUDO_1_7_0~472 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b166928baca9e534d906c0240e48c5b8fb4c7f25;p=sudo 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. --- 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);