From nobody Fri Jan 17 12:27:10 2025 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 4YZJrv0s37z5kvZL; Fri, 17 Jan 2025 12:27:11 +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 4YZJrt3FQyz3Tpq; Fri, 17 Jan 2025 12:27:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737116830; 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=Swgouq3xRhZBvQqHkvaqAXuheaChNefX47wwmO+6Rvc=; b=fQZYln1eTKz/xkjbx+HfOHabUzHsOLLOcXON/4AZwCoRjlftUPEQjjX81rgHeiLWixp0/9 2PDjI321koLxLc7jW3Xw26VgPWdx6ERs3uXt7Y4kCbZ1Vrc3FWKAI8hK19iDpGtaZZyYkx KNkSqdErT9qvxTSgqF4D8fvJ9N1oqFa8O4S6MnXC50/aAaW9Nx4F1FCOeJhFsmURugU4Bz 7pc/xsFHHdU9SZtvdLDJ6Ncw1pnnt0gd8a1qWeSjELmFx6Hyx+HbAGbVoN7Bz2ndohcHwf e8ZCfxXrwAdi/ErJbN8HSBDbCSKGvB6gSzNsRqCD8I28Z+h1B88jc1zYoUyofg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737116830; 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=Swgouq3xRhZBvQqHkvaqAXuheaChNefX47wwmO+6Rvc=; b=OtNXNvbSh5c/rSB/jAxNjcqbVW/KPIJRq07Jka33ugDsiwYNrtSSUbB+dUfaUaXA3cBnui bECdI/6ElIJquGG2CYTfYrorPynZvoNl7PuF3cRi0H8tijkPeOQ0Bdk0bLzuzGlzAOj5Up NurdoY+POgleQiUMhFOxjdSjbPRvRAORxCv7FMXsZQDtDnIv9c2F/2S5pyr/7qhuj/1Sww C+ChyEqNpMQ+cBBJx4ceClDKYm20J8yNOB5z0nk22H+W1AKuAq/bmjeilTcl8UAm/XBgOG Q0P1mxhVOaAww7sasuJeF7uMx9gkjmBgBKm0Eler+C2MbVB04wld5qPm9aJFAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737116830; a=rsa-sha256; cv=none; b=TKVTnVQBFnrXyDnrGyYHdFU24JlzLUU6CVHcIiEmkvhE3lRzO7cp/h5jb9oU04pafmPI9g egTyx0kWQfhxOzIBWHaCvHkGnbHqurXaiXx/IJO4JQ+SFCKaknlLzKI+EeQC+2TyodPONQ 9KIFQ+xwmRxa7cW9oeLi1ZFWB/fRcYNtR8EwzWjoo1DRDk7oqQESQEJ+JoeCHAsvksHyKe UIANJr3bnuFJac4qS3uD8MJwuRQs5ZTSUynALjfr4lMIJdVHd4FT8K423qxIsI9Pa5LsTa ynmgIFiCrXWCYW1ZxOvQGy61T72q8z1LZ7i9RZ9cUd49ZASM05BTXVZPYaonFQ== 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 4YZJrt2pS1z2lw; Fri, 17 Jan 2025 12:27:10 +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 50HCRA7e052330; Fri, 17 Jan 2025 12:27:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HCRAJ5052327; Fri, 17 Jan 2025 12:27:10 GMT (envelope-from git) Date: Fri, 17 Jan 2025 12:27:10 GMT Message-Id: <202501171227.50HCRAJ5052327@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: 0c0cd622f279 - stable/13 - mountd(8): parsecred(): Remove "duplicate compression" 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/13 X-Git-Reftype: branch X-Git-Commit: 0c0cd622f2797214e76d19bd45bbbfaa4dd21cf4 Auto-Submitted: auto-generated The branch stable/13 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=0c0cd622f2797214e76d19bd45bbbfaa4dd21cf4 commit 0c0cd622f2797214e76d19bd45bbbfaa4dd21cf4 Author: Olivier Certner AuthorDate: 2024-09-26 17:00:26 +0000 Commit: Olivier Certner CommitDate: 2025-01-17 12:24:51 +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 47bb5758ee1e..ebd88d3fdd66 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -3569,7 +3569,6 @@ static void parsecred(char *namelist, struct expcred *cr) { char *name; - int inpos; char *names; struct passwd *pw; struct group *gr; @@ -3611,23 +3610,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; } /*