From nobody Sat Feb 4 00:28:24 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 4P7tfc3BTsz3kRGS; Sat, 4 Feb 2023 00:28:24 +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 4P7tfc2mHsz3sQl; Sat, 4 Feb 2023 00:28:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675470504; 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=HL0nzH7U2Psq684uap/gXeEWxbR8HTM0xRdtToXcnUk=; b=Ke4U68uExGJbhhEyk8bgyh7pCaStnn5Clp0oyMjj+HyQkAuKjxizdWDj1gT3WbhOS0VPzF JHCc8q9QDf6XufWyjvzp3okc1NtAtqp8GeWZ//FsGc0jQh96ka23Lja0AH2s/uLBLo+zl+ Cdsn1lXguvGz5fHRDChPvDsIXW4PC+w5uZlah1dNhAkcXGuPAEK+UTIDqrztIQD4rIkJn8 rJSf+ZIJdbITbWjeNsPm8TykZAIFLUvmaLMcVbr07CaS/3Uh+upaDkSmNpuhFSpfQMbUhb 89o0w9hUdlaGRwmtsvHRxKkUsz7GP/cDAn0AoRYt8dy55shjtcZ6r/yFDbZAgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675470504; 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=HL0nzH7U2Psq684uap/gXeEWxbR8HTM0xRdtToXcnUk=; b=Np6YwbB3z1DZSrhZA6NCTldiwJQnsKTEYhvr3L4YovHmIPOXDGRAlttSSeRBVkhcpm9FI8 0kF/2m8vbiH3O+1XqFtlQO1+GPPbDUEsKKGGRN+XKk3poNCs2/84IagDp/+/mZKFmPtSav AWHyNP96WJI9dgIZ6CXS+tEENvCyvNW82Zp5z0uJpBDkum3akP+ENJI81PYPH73ZfUhynG ezd1MIKv+GPQZMYr7gnMHZbsRWYlss+tfc2lmWhYWyZQ6mbJLah0S69VMzLw3fQ/yv/9vR X9ULKVAwCItJ/6hCCqKypioKiH/higG8lmyGdfpob7M0ryCaUhKUo1AeUoy8hA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675470504; a=rsa-sha256; cv=none; b=CI7zDCTKZLkMeNsj80dMyD+Cfz6zhUJToVhpZ3ifZUQWrozq6s7AIbm7bu+fZz+VTd2/qP TJoRLQel0yHcnD2CJGRcgRW6kzs+p8R61G/q1QyRUc7j5vu1cMrYG3cgofev3mhpYRhI9o PA7E+4Xjek7OrFsHYZNUqrcz6PuVev11SGAJyG4KCQGhZMB3ClMiTzZilqqy92mR9REJTW XhXwnsac41Bld5f2Uivnv6pXApqJuzFwVcpZT+2Cfdwx+2KEsK4zpCs0rk1SH7r1PpuMNl lvRKSgF9jLU0JWce4UNa2LJa4IMBfhdZPiKjMaPjbQoAYvcNAahrq+S7+TbdVg== 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 4P7tfc1pGZzvXC; Sat, 4 Feb 2023 00:28:24 +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 3140SO2j054186; Sat, 4 Feb 2023 00:28:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3140SOrg054185; Sat, 4 Feb 2023 00:28:24 GMT (envelope-from git) Date: Sat, 4 Feb 2023 00:28:24 GMT Message-Id: <202302040028.3140SOrg054185@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: b96684daa837 - stable/12 - pwd_mkdb(8): Don't copy comments from /etc/master.passwd to /etc/passwd. 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: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b96684daa837462342093344a144e0ee636a9e22 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=b96684daa837462342093344a144e0ee636a9e22 commit b96684daa837462342093344a144e0ee636a9e22 Author: Andre Albsmeier AuthorDate: 2010-03-11 10:53:47 +0000 Commit: Xin LI CommitDate: 2023-02-04 00:27:55 +0000 pwd_mkdb(8): Don't copy comments from /etc/master.passwd to /etc/passwd. The intention of /etc/passwd was to support legacy applications that are not yet converted to use modern API like getpwent(3). Comments are not defined in the legacy format, so copying them could break these applications. Plus, it could leak sensitive information (e.g. encrypted form of password of an user that was commented out instead of deleted or disabled). PR: bin/144652 (cherry picked from commit 0deb25bd9d6d2cdd4aa22f0e2754161e35f3785c) --- usr.sbin/pwd_mkdb/pwd_mkdb.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index 13fae9510af8..601e0e71bfd5 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -470,11 +470,14 @@ main(int argc, char *argv[]) error("put"); } } - /* Create original format password file entry */ - if (is_comment && makeold){ /* copy comments */ - if (fprintf(oldfp, "%s\n", line) < 0) - error("write old"); - } else if (makeold) { + /* + * Create original style password file entry. + * + * Don't copy comments since this could reveal encrypted + * passwords if entries have been simply commented out + * in master.passwd. + */ + if (makeold && !is_comment) { char uidstr[20]; char gidstr[20];