Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Aug 2009 05:12:37 +0000 (UTC)
From:      Jonathan Chen <jon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r196650 - head/lib/libpam/modules/pam_lastlog
Message-ID:  <200908300512.n7U5Cbg2084038@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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')



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908300512.n7U5Cbg2084038>