Author: jon
Date: Sun Aug 30 05:12:37 2009
New Revision: 196650
URL: http://svn.freebsd.org/changeset/base/196650

Log:
  Prevents pam_lastlog from segfaulting on session close when tty is null.
  
  MFC after:    1 month

Modified:
  head/lib/libpam/modules/pam_lastlog/pam_lastlog.c

Modified: head/lib/libpam/modules/pam_lastlog/pam_lastlog.c
==============================================================================
--- head/lib/libpam/modules/pam_lastlog/pam_lastlog.c   Sun Aug 30 02:07:23 
2009        (r196649)
+++ head/lib/libpam/modules/pam_lastlog/pam_lastlog.c   Sun Aug 30 05:12:37 
2009        (r196650)
@@ -183,6 +183,11 @@ pam_sm_close_session(pam_handle_t *pamh 
        pam_err = pam_get_item(pamh, PAM_TTY, (const void **)&tty);
        if (pam_err != PAM_SUCCESS)
                goto err;
+       if (tty == NULL) {
+               PAM_LOG("No PAM_TTY");
+               pam_err = PAM_SERVICE_ERR;
+               goto err;
+       }
        if (strncmp(tty, _PATH_DEV, strlen(_PATH_DEV)) == 0)
                tty = (const char *)tty + strlen(_PATH_DEV);
        if (*(const char *)tty == '\0')
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to