From owner-svn-src-stable@FreeBSD.ORG Sun Jan 24 14:30:58 2010 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 253F31065676; Sun, 24 Jan 2010 14:30:58 +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 13D578FC12; Sun, 24 Jan 2010 14:30:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0OEUvDu055289; Sun, 24 Jan 2010 14:30:57 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0OEUvbO055287; Sun, 24 Jan 2010 14:30:57 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201001241430.o0OEUvbO055287@svn.freebsd.org> From: Ed Schouten Date: Sun, 24 Jan 2010 14:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202929 - stable/8/lib/libutil 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: Sun, 24 Jan 2010 14:30:58 -0000 Author: ed Date: Sun Jan 24 14:30:57 2010 New Revision: 202929 URL: http://svn.freebsd.org/changeset/base/202929 Log: MFC r202500: Fix a regression that was introduced in r191882. I changed login_tty() to only work when the application is not a session leader yet. This works fine for applications in the base system, but it turns out various applications call this function after daemonizing, which means they already use their own session. If setsid() fails, just call tcsetsid() on the current session. tcsetsid() will already perform proper security checks. Reported by: Oliver Lehmann Modified: stable/8/lib/libutil/login_tty.c Directory Properties: stable/8/lib/libutil/ (props changed) Modified: stable/8/lib/libutil/login_tty.c ============================================================================== --- stable/8/lib/libutil/login_tty.c Sun Jan 24 14:29:40 2010 (r202928) +++ stable/8/lib/libutil/login_tty.c Sun Jan 24 14:30:57 2010 (r202929) @@ -50,7 +50,7 @@ login_tty(int fd) s = setsid(); if (s == -1) - return (-1); + s = getsid(0); if (tcsetsid(fd, s) == -1) return (-1); (void) dup2(fd, 0);