Some versions of pam_lastlog have a bug that will cause a crash if
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 22 Jul 2007 12:13:07 +0000 (12:13 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 22 Jul 2007 12:13:07 +0000 (12:13 +0000)
PAM_TTY is not set so if there is no tty, set PAM_TTY to the empty
string.

auth/pam.c

index 2ecf2f7a11eb94eee97ab8f625e251e9ce393199..d6f5914f80e055a1d20a7fca529492f496e463a6 100644 (file)
@@ -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);