From nobody Thu Jan 16 18:08:20 2025 X-Original-To: dev-commits-src-branches@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 4YYrT203x2z5kl2y; Thu, 16 Jan 2025 18:08:22 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYrT06dMtz3Rb7; Thu, 16 Jan 2025 18:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737050900; 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=OGqb5dIkKYsfzBT8lUfFNJDA8E2b5B1QlKGNHITTliQ=; b=nxN9DR+4xFZytpM8f7NFm0vofDpZzKC56pbNRG8b4o6upT5tbwqtG/ism4xQS51BBHTxFr ZhzpLET04Gt9s+hkLrpTr/Ft9KkSSf5JbSm2ZFKu/OT1iGI/yqUi3FG1fKx+ND9WpyVHDd ORkcjxsuHq1y7Qp8OxLw/iC+/6TdOV0hjsF/Qr3/OCDYMxy1ycOZcAYLlTFKZiwcXH8Myh IeKMhR4WuecmgO/bVEHRYy+i7kOqHz+6dCVW+mKPuaqtBKYI+JRngikOYtoqe1UGwA8kjG r9IRy5HKdWV9dSm/5exXeIPhe5lBPOjdcRk+i3dRRmmfH1SE0owW5X+J3JK7qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737050900; 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=OGqb5dIkKYsfzBT8lUfFNJDA8E2b5B1QlKGNHITTliQ=; b=FXvRi25PP/OCykliSELxQ0+xy3/KIQrQK/RJOnWXgCIUsPvliLTtpWM9WULoAGj2jJsxPB FG7rjQ5KJ6OjHRUyb92dhvCwhcr5kYkr2InkNx6aUxqKy8r/wyrYbr/0RZGypnaNKkmbqF PzBVFRdvJvpfDbKuY2z7g1NLcH0pLOVqKHoqoNwG8oedRiQ4qBQwBbpbEcHQnpow4Gaccy RHFYhxxV9/s015D7USQRzt8Tzx32ip6haKzYsQRRkpSR9gn3BupEsrCh3LDdbIL8AgmlQu igCCqGuxlP/LOw+OIugtX+QvnutuEO+CIY0d70h0vd9KDeqZakJ1xvjWoF590A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737050900; a=rsa-sha256; cv=none; b=aYZX3PcDb+lOU7YZ/6ExajznIeyK/wzXsIFrywrtm8ikO8WEnTDBdCa2PwKm02HEdVIr3T a98Ld3ho4exyAzj6ucceOOo9WXi5tcXYfIue5KsBR12D7+VPvjcw2M3pNlCmB/dDxWrr+M mtOg1bytKPjNqnJ+koU3BIP3WIwtKgPtSP04T9RqOhcOX/U0xrPlvVRB5cqOrFERxim9mo cVFUAPxx7FiiufW2ei/S7tAWRnz7ikiymxJF8Jmtjo4PO35v7C9wgmOkE/H5Rm09uZgha4 L2TrBhwbznK/akKDe0TVRIwG+va6EsGvj6j8N95kUZqlvKgygMNJsQNpQnToZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YYrT06DDfzkKh; Thu, 16 Jan 2025 18:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GI8KD4092057; Thu, 16 Jan 2025 18:08:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GI8Kms092054; Thu, 16 Jan 2025 18:08:20 GMT (envelope-from git) Date: Thu, 16 Jan 2025 18:08:20 GMT Message-Id: <202501161808.50GI8Kms092054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: a633b10e3d85 - stable/14 - mountd(8): parsecred(): Remove "duplicate compression" List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a633b10e3d85345cfc80c1043825fa440fbc5753 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=a633b10e3d85345cfc80c1043825fa440fbc5753 commit a633b10e3d85345cfc80c1043825fa440fbc5753 Author: Olivier Certner AuthorDate: 2024-09-26 17:00:26 +0000 Commit: Olivier Certner CommitDate: 2025-01-16 18:06:57 +0000 mountd(8): parsecred(): Remove "duplicate compression" No functional change (intended). This code dates back to 4.4BSD, became wrong after some getgrouplist() (nssswitch-related) change in 2007, was fixed only in 2020 and since then underwent cosmetic changes. It is likely that in fact it never served any useful purpose in FreeBSD, except perhaps at the very beginning. It's most probably not the case today: NFS credentials are normally only used to check for file accesses, whose group is checked against all groups of a credentials indiscriminately (except for the real GID). Consequently, having a single duplicate, which the code would actually remove only if in the first supplementary group slot, doesn't change behavior. Moreover, we are going to regain one slot in a subsequent commit. Discussed with: rmacklem Approved by: markj (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46920 (cherry picked from commit f2d2318fafbb16c8a7773fe20c724c986f424fa2) --- usr.sbin/mountd/mountd.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index e01140593c11..f7ab5d6d696d 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -3612,7 +3612,6 @@ static void parsecred(char *namelist, struct expcred *cr) { char *name; - int inpos; char *names; struct passwd *pw; struct group *gr; @@ -3654,23 +3653,12 @@ parsecred(char *namelist, struct expcred *cr) ngroups = NGROUPS_MAX + 1; } - /* - * Compress out duplicate. - */ - if (ngroups > 1 && groups[0] == groups[1]) { - ngroups--; - inpos = 2; - } else { - inpos = 1; - } if (ngroups > NGROUPS_MAX) ngroups = NGROUPS_MAX; if (ngroups > SMALLNGROUPS) cr->cr_groups = malloc(ngroups * sizeof(gid_t)); cr->cr_ngroups = ngroups; - cr->cr_groups[0] = groups[0]; - memcpy(&cr->cr_groups[1], &groups[inpos], (ngroups - 1) * - sizeof(gid_t)); + memcpy(cr->cr_groups, groups, ngroups * sizeof(gid_t)); return; } /*