From nobody Mon Dec 16 14:45:23 2024 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 4YBjR81kRnz5hWND; Mon, 16 Dec 2024 14:45: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YBjR801Hyz4cqy; Mon, 16 Dec 2024 14:45:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734360324; 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=3POhBwzW5kJVBvDLwxWLtWQgdoanfKU9IskXhthI40E=; b=N8JGslYzt5WXPHLorWQlaPL7RTu0Uc3B5mYC3r0zmZViiW/DwbTW9PT/EP85Tt8O3/snHD 7DrLPqwxTot6vEhblabxRcs8bS7Zt5Raw2xbl8UBYPux33zeJJ8VdvCNbSQYK7oYtF0iDq 8krmUQ1GLzKaPrUQnIoJxfdazxDlb6Z2r0DudwASLFNB4Y1DZnkv3n+UHMbUkuAVgN42iA P7DSHASI0kbCt6e5RJznh/Rq1Yz0D0EVgbgAbCiL89g1tE3vhY68ZGDZR32DicqPUR8M84 tQVE8ZOG/aEdsH6VlbBi2LuaBMXU6Bqq8uMQbdmktPJfnbmIBYW8+NbNxUNGCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734360324; 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=3POhBwzW5kJVBvDLwxWLtWQgdoanfKU9IskXhthI40E=; b=SAOItlW0Iv2BlqWttaVpVOcndAgCWBzpciNMtJSrQdHau3nvGtcMC9fPTAmQjPHGW5b51x cpKC9Ug7AlKGCncgsz9seSThIKm+LKZx3oxVMfoS2NszwB7bhJP8yX7PZ4txbtOLeGj/g6 Kfh774NxWadDlSLddiBGf89HGnlKBSrBvCgJXqe7b71lveAAyB+vd9UvrSYMAWG2uCc0Om rf/cM/r5hnE3Ec7UZw2uLxZE/tm+uGcEnN0u4Cxks1GDZ9jZ/O3fheacM2WvnjnPhgbNig 2J39V5AMWYgrspqp1wZZwL+3+hvemKGDFjwoWzx4MM7jmvHweFwtJ8rbJDFJbA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734360324; a=rsa-sha256; cv=none; b=bxSW5KgFty3w/0NcLRhkfz1PdVPahNP/H7DdjTN8XqQxJT92sfd2kDINMBdJHFUKFl7jO+ ibHhjUlooVYZfjqQGf4pTBE1gIEKp4R4HTclxT8aK6epAZIXc3XclcZf4VFSTnFOsqADg9 zEltw/0iyOKHgySv+1Mau0yIeGtKd3oaDRTb32FuJ7YYpLYLXNl4nYveIWt+HAl/YoEuXD 4rUexMzeQqXfUgRXVc9BpBdQcGRphxAy0Tt08WlJuN2N36Ho6KF6Lrt1xn3PxzEpV5yPio cyhYmQ6AzBG7dTRCPLC0TGB+G0Jst/Q/Skoz36Y+m5fEuqOlkyWHt+TDWqXYFw== 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 4YBjR76TTTzxB9; Mon, 16 Dec 2024 14:45:23 +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 4BGEjNRU051839; Mon, 16 Dec 2024 14:45:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BGEjNvf051836; Mon, 16 Dec 2024 14:45:23 GMT (envelope-from git) Date: Mon, 16 Dec 2024 14:45:23 GMT Message-Id: <202412161445.4BGEjNvf051836@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: f2d2318fafbb - main - 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/main X-Git-Reftype: branch X-Git-Commit: f2d2318fafbb16c8a7773fe20c724c986f424fa2 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=f2d2318fafbb16c8a7773fe20c724c986f424fa2 commit f2d2318fafbb16c8a7773fe20c724c986f424fa2 Author: Olivier Certner AuthorDate: 2024-09-26 17:00:26 +0000 Commit: Olivier Certner CommitDate: 2024-12-16 14:42:29 +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 --- 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 c903431c2ecf..22ed57d8669d 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -3610,7 +3610,6 @@ static void parsecred(char *namelist, struct expcred *cr) { char *name; - int inpos; char *names; struct passwd *pw; struct group *gr; @@ -3652,23 +3651,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; } /*