From nobody Tue Jun 27 17:22:02 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QrBNB5kYLz4f69V; Tue, 27 Jun 2023 17:22:02 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QrBNB5GNVz3jDf; Tue, 27 Jun 2023 17:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687886522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wCWZUZojmppVkA+ig4+9/BTwMrWNA3ie//Me12AXY5U=; b=RFU9b7vfFpd4jzRGUBYMUgWVsBUSzYFy9wqGnln05rL3/BGONoLICtRSzaWaCfFiHUJfNU A0wZNs/A8CBsH1Sy0W848Aw6Ygme1C12ZLzHvWmL3gFY8W0ZaSJUXJpcLWoOhvfHsJLyXo oeAs/4dsuaZu+NBvEEFNxJlgN4psxzLJU8zPfSv8XAVCBni41p6Visq1Wpw05x7EloJxfE Bsfq9xa3YP04NkRior9yc93iNUPJvdLFC2gdWNyXBndkQIY84MXbynLwiPxwma8hYf8MED BUhutjbHIJYxLBcrQLsvRZXhPqP2axj/hxN9piWIIcsyUCp3QWHCMFWN5/6B9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687886522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wCWZUZojmppVkA+ig4+9/BTwMrWNA3ie//Me12AXY5U=; b=eKKsDQWI9G+70/71AkktprhISz0gDsDtKUgB78q/JEt5jd+YsWqIgi8qA8b0YeofQns+bC WPkLIsYKHhvui8kRxAgOUXf88mjGmQvMYB6sGsXgG2yb1utWOkctfxxN2QKQ+oRl+OFRb6 AnwHaksczCUdNeTEgazs3z36sKvGayE6rkElZxneX1Fn+UUOGRq8jshHhC0FdEqrmOnmUI rSkohP8KLXSTMMx2exjWsqUVjPla/R7G+Hq0MlfSAsYEHJArVlYE7YxIbijLhiriFt8xIC D7YvuqaKoSZHg6aBC8jQBgZiawaydXnkugZBH8T1/+Lkr9KIojOI0phg4JKPUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687886522; a=rsa-sha256; cv=none; b=C8wQg/SzgUZAwXdf9RLEO/d2t+GlQuKbWwkA7nB/H4RRrqZxRF0A1nCBdBhWz3DX6X7Cya nCcPy5cy74qm5/qxg7cf1xv9ZtMW6gEFGhDo6N3Mhr45KFc4xJjWQ1cmR251H5SMByFnf0 dIzsLz73dpHK7neqFGBBWclB3QV+CIFuO6cNEWKyodx8EVocRvtCiG+K9spMUKdHDIvagG qU7/aU7xKEeZW0n+xThql98+zpoVoMP2d/rws9WQFUKxVktMm/w3tm/vu8lwKPfJp8Q6K7 +RYnkIkA0r8UlFpJbtUMBt0Ong+UDePKW8nj1TMKrrHNEYUoG/Xlb3Zg+JWe1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QrBNB4LvMz10nH; Tue, 27 Jun 2023 17:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35RHM26l021153; Tue, 27 Jun 2023 17:22:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35RHM2bv021152; Tue, 27 Jun 2023 17:22:02 GMT (envelope-from git) Date: Tue, 27 Jun 2023 17:22:02 GMT Message-Id: <202306271722.35RHM2bv021152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 372f51eaf363 - stable/12 - Merge upstream r948: fix race condition in openpam_ttyconv(3). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 372f51eaf3638036eddeac6710afa00d6582bea4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=372f51eaf3638036eddeac6710afa00d6582bea4 commit 372f51eaf3638036eddeac6710afa00d6582bea4 Author: Dag-Erling Smørgrav AuthorDate: 2020-11-19 05:46:59 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-06-27 17:21:25 +0000 Merge upstream r948: fix race condition in openpam_ttyconv(3). (cherry picked from commit a90c7d9aa82430454b3194d6750e0c0c748ac6dc) --- contrib/openpam/CREDITS | 1 + contrib/openpam/lib/libpam/openpam_ttyconv.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/contrib/openpam/CREDITS b/contrib/openpam/CREDITS index b40c9d3b4826..a560f9e12c1f 100644 --- a/contrib/openpam/CREDITS +++ b/contrib/openpam/CREDITS @@ -18,6 +18,7 @@ ideas: Ankita Pal Baptiste Daroussin Brian Fundakowski Feldman + Brooks Davis Christos Zoulas Daniel Richard G. Darren J. Moffat diff --git a/contrib/openpam/lib/libpam/openpam_ttyconv.c b/contrib/openpam/lib/libpam/openpam_ttyconv.c index 8066b3b67298..1a50f1c99639 100644 --- a/contrib/openpam/lib/libpam/openpam_ttyconv.c +++ b/contrib/openpam/lib/libpam/openpam_ttyconv.c @@ -94,12 +94,6 @@ prompt_tty(int ifd, int ofd, const char *message, char *response, int echo) 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) { @@ -115,6 +109,12 @@ prompt_tty(int ifd, int ofd, const char *message, char *response, int echo) } } + /* write prompt */ + if (write(ofd, message, strlen(message)) < 0) { + openpam_log(PAM_LOG_ERROR, "write(): %m"); + return (-1); + } + /* install signal handlers */ caught_signal = 0; action.sa_handler = &catch_signal;