Date: Thu, 16 Jan 2025 18:08:20 GMT From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: a633b10e3d85 - stable/14 - mountd(8): parsecred(): Remove "duplicate compression" Message-ID: <202501161808.50GI8Kms092054@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=a633b10e3d85345cfc80c1043825fa440fbc5753 commit a633b10e3d85345cfc80c1043825fa440fbc5753 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-09-26 17:00:26 +0000 Commit: Olivier Certner <olce@FreeBSD.org> 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; } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501161808.50GI8Kms092054>