From owner-svn-src-head@freebsd.org Thu Nov 19 05:47:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACFC12E8030; Thu, 19 Nov 2020 05:47:00 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cc7wh4WRFz3lGM; Thu, 19 Nov 2020 05:47:00 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E06C1EF2E; Thu, 19 Nov 2020 05:47:00 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AJ5l03t080179; Thu, 19 Nov 2020 05:47:00 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AJ5l0Ef080177; Thu, 19 Nov 2020 05:47:00 GMT (envelope-from des@FreeBSD.org) Message-Id: <202011190547.0AJ5l0Ef080177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Thu, 19 Nov 2020 05:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367832 - in head/contrib/openpam: . lib/libpam X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: in head/contrib/openpam: . lib/libpam X-SVN-Commit-Revision: 367832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2020 05:47:00 -0000 Author: des Date: Thu Nov 19 05:46:59 2020 New Revision: 367832 URL: https://svnweb.freebsd.org/changeset/base/367832 Log: Merge upstream r948: fix race condition in openpam_ttyconv(3). Modified: head/contrib/openpam/CREDITS head/contrib/openpam/lib/libpam/openpam_ttyconv.c Directory Properties: head/contrib/openpam/ (props changed) Modified: head/contrib/openpam/CREDITS ============================================================================== --- head/contrib/openpam/CREDITS Thu Nov 19 05:44:41 2020 (r367831) +++ head/contrib/openpam/CREDITS Thu Nov 19 05:46:59 2020 (r367832) @@ -18,6 +18,7 @@ ideas: Ankita Pal Baptiste Daroussin Brian Fundakowski Feldman + Brooks Davis Christos Zoulas Daniel Richard G. Darren J. Moffat Modified: head/contrib/openpam/lib/libpam/openpam_ttyconv.c ============================================================================== --- head/contrib/openpam/lib/libpam/openpam_ttyconv.c Thu Nov 19 05:44:41 2020 (r367831) +++ head/contrib/openpam/lib/libpam/openpam_ttyconv.c Thu Nov 19 05:46:59 2020 (r367832) @@ -94,12 +94,6 @@ prompt_tty(int ifd, int ofd, const char *message, char int pos, ret; char ch; - /* write prompt */ - if (write(ofd, message, strlen(message)) < 0) { - openpam_log(PAM_LOG_ERROR, "write(): %m"); - return (-1); - } - /* turn echo off if requested */ slflag = 0; /* prevent bogus uninitialized variable warning */ if (!echo) { @@ -113,6 +107,12 @@ prompt_tty(int ifd, int ofd, const char *message, char openpam_log(PAM_LOG_ERROR, "tcsetattr(): %m"); return (-1); } + } + + /* write prompt */ + if (write(ofd, message, strlen(message)) < 0) { + openpam_log(PAM_LOG_ERROR, "write(): %m"); + return (-1); } /* install signal handlers */