From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 17:50:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FB46106566C; Fri, 3 Feb 2012 17:50:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EDCDD8FC16; Fri, 3 Feb 2012 17:50:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13Hodoo097660; Fri, 3 Feb 2012 17:50:39 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13HodDw097658; Fri, 3 Feb 2012 17:50:39 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201202031750.q13HodDw097658@svn.freebsd.org> From: Ed Schouten Date: Fri, 3 Feb 2012 17:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230952 - stable/9/lib/libpam/modules/pam_lastlog X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 17:50:40 -0000 Author: ed Date: Fri Feb 3 17:50:39 2012 New Revision: 230952 URL: http://svn.freebsd.org/changeset/base/230952 Log: MFC r227314: Ensure pam_lastlog removes the /dev/ component of the TTY name. Some consumers of PAM remove the /dev/ component (i.e. login), while others don't (i.e. su). We must ensure that the /dev/ component is removed to ensure that the utmpx entries properly work with tools such as w(1). Modified: stable/9/lib/libpam/modules/pam_lastlog/pam_lastlog.c Directory Properties: stable/9/lib/libpam/ (props changed) Modified: stable/9/lib/libpam/modules/pam_lastlog/pam_lastlog.c ============================================================================== --- stable/9/lib/libpam/modules/pam_lastlog/pam_lastlog.c Fri Feb 3 17:36:32 2012 (r230951) +++ stable/9/lib/libpam/modules/pam_lastlog/pam_lastlog.c Fri Feb 3 17:50:39 2012 (r230952) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #define _BSD_SOURCE #include + +#include #include #include #include @@ -96,6 +98,9 @@ pam_sm_open_session(pam_handle_t *pamh, pam_err = PAM_SERVICE_ERR; goto err; } + /* Strip /dev/ component. */ + if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + tty = (const char *)tty + sizeof(_PATH_DEV) - 1; if ((flags & PAM_SILENT) == 0) { if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) {