svn commit: r196650 - head/lib/libpam/modules/pam_lastlog

Jonathan Chen jon at FreeBSD.org
Sun Aug 30 05:12:38 UTC 2009


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')


More information about the svn-src-all mailing list