From nobody Fri Dec 19 09:19:05 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 4dXhmn4nDSz6LBFC for ; Fri, 19 Dec 2025 09:19:05 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dXhmn1rlRz44bw for ; Fri, 19 Dec 2025 09:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766135945; 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=gUD2CuJRGhkW/LiyjUrP9b053l0/75UNfjbkllSCi/0=; b=XmyqEmzjrvGULRBE2Oo6oxPhNKLhp7yc4R7vMF3SGTmX+VZlkJkt4rM1+tLBgl6kzWvIu6 alMXBWl6kM0ZtgSax22XDNKyo0y7EiCeyDrHHcVaXH64bpTKuVhqtGCOGJdKCWx+u5+n/u Zu06MgRiSJsoO4ZFAAEM/GM1F7qGm4+ODRZEetKIoDzYLRT6YebNbUAmzFGZ4vCu3oCobz 7yCVRlZZNM2zTsuLIaq2WTAxpap43uYQEm2oYblZU0+ReK+H9mJXBQMHRJj76xsncLk/Mw xZCDRY7ZI1fgviwQ44VVMx9TW2c4wrtXysDG6AQyjTg4Ki3vSfLUDbscZI5eCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766135945; 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=gUD2CuJRGhkW/LiyjUrP9b053l0/75UNfjbkllSCi/0=; b=Aut1wb/CuwSTmnCRuzX2OScvrMR5tyAanDOXxyG07DkZ4FR3tAKhBRHjLPgdAqwGhUNNi2 LklNh4RqSpV54AS/2n2HQeAlMiNTo9UBwAK3KVh83AKKRCF2g6YgxQppQyhPPiddLpBNVE kTSAw/lk/FkaUd1KrPmzo122ySoBIAVgdSK7qtwi6T4uN/hzvg4V3gWLmYs1nMEcfQbLru vXC5VmcWtkv/zsMKyZU00JE5d6hheNWyfItId9qSYeP+mcJmAromA2/lIRfCkdI2cdXKnN yaZ17Fevg6fK25fvd4BzxA9hjnLOEHIEEQgCpgqn9Q5QMf3u6SKHUUj/+e6wyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766135945; a=rsa-sha256; cv=none; b=JOiTfqvlbwwMLMyZ0rPioA8EFSVKnBHLeL6SbvBxGHAMioXnLmsRBlVC2Us9P2sxDXvaNS YlLZBngaHK7itGBKYdeI6PfgXbfurbpdnNZXTQX4Aytlt4TnnxIpH4/mYyzKNXk67i6oRs nIpmz96NYQMnEQ4PvQAPQasYtOQ1+Ro9SM8+4/NXvAq/lOSo6zb0kBPdf+SztAP1ZwZ6mz QV38XNkjGCeJi84ffO8ZEZlFLLvRaT8NL3j9fhcrNa5xVtTEDboGtdZyBYzAcVL0b8eSmx KIG9eUoHYBZ32aaOI1vwbhkqR+OkJ20F6xhxPApr0tDjhjaEJp4yiwqxIn2Rxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dXhmn114Cz1GNL for ; Fri, 19 Dec 2025 09:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3de7c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 19 Dec 2025 09:19:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: ede3009e4569 - stable/14 - sys/rpc: UNIX auth: Rename 'ngroups' => 'supp_ngroups' for clarity 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/14 X-Git-Reftype: branch X-Git-Commit: ede3009e4569b79055643b8fd65b4165092e8517 Auto-Submitted: auto-generated Date: Fri, 19 Dec 2025 09:19:05 +0000 Message-Id: <69451889.3de7c.7fa701f1@gitrepo.freebsd.org> The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=ede3009e4569b79055643b8fd65b4165092e8517 commit ede3009e4569b79055643b8fd65b4165092e8517 Author: Olivier Certner AuthorDate: 2025-10-07 10:03:07 +0000 Commit: Olivier Certner CommitDate: 2025-12-19 09:16:43 +0000 sys/rpc: UNIX auth: Rename 'ngroups' => 'supp_ngroups' for clarity MFC after: 2 days Sponsored by: The FreeBSD Foundation (cherry picked from commit bda3b61512b2597d4c77d2b9c9074b844dec0405) Two minor conflicts, due to missing comments added in commit be1f7435ef21 ("kern: start tracking cr_gid outside of cr_groups[]") which will not be MFCed, were solved by adding these comments. --- sys/rpc/authunix_prot.c | 21 +++++++++++++-------- sys/rpc/svc_auth_unix.c | 21 +++++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/sys/rpc/authunix_prot.c b/sys/rpc/authunix_prot.c index 8c10de166f2f..42822a5d01c6 100644 --- a/sys/rpc/authunix_prot.c +++ b/sys/rpc/authunix_prot.c @@ -64,7 +64,7 @@ bool_t xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred) { uint32_t namelen; - uint32_t ngroups, i; + uint32_t supp_ngroups, i; uint32_t junk; char hostbuf[MAXHOSTNAMELEN]; @@ -101,14 +101,19 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred) return (FALSE); if (xdrs->x_op == XDR_ENCODE) { - ngroups = cred->cr_ngroups - 1; - if (ngroups > NGRPS) - ngroups = NGRPS; + /* + * Note that this is a `struct xucred`, which maintains its + * historical layout of preserving the egid in cr_ngroups and + * cr_groups[0] == egid. + */ + supp_ngroups = cred->cr_ngroups - 1; + if (supp_ngroups > NGRPS) + supp_ngroups = NGRPS; } - if (!xdr_uint32_t(xdrs, &ngroups)) + if (!xdr_uint32_t(xdrs, &supp_ngroups)) return (FALSE); - for (i = 0; i < ngroups; i++) { + for (i = 0; i < supp_ngroups; i++) { if (i < ngroups_max) { if (!xdr_uint32_t(xdrs, &cred->cr_groups[i + 1])) return (FALSE); @@ -119,10 +124,10 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred) } if (xdrs->x_op == XDR_DECODE) { - if (ngroups > ngroups_max) + if (supp_ngroups > ngroups_max) cred->cr_ngroups = ngroups_max + 1; else - cred->cr_ngroups = ngroups + 1; + cred->cr_ngroups = supp_ngroups + 1; } return (TRUE); diff --git a/sys/rpc/svc_auth_unix.c b/sys/rpc/svc_auth_unix.c index cc8354d93281..c821b7901ea6 100644 --- a/sys/rpc/svc_auth_unix.c +++ b/sys/rpc/svc_auth_unix.c @@ -69,7 +69,7 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg) uint32_t time; struct xucred *xcr; u_int auth_len; - size_t str_len, gid_len; + size_t str_len, supp_ngroups; u_int i; xcr = rqst->rq_clntcred; @@ -88,29 +88,34 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg) buf += str_len / sizeof (int32_t); xcr->cr_uid = IXDR_GET_UINT32(buf); xcr->cr_gid = IXDR_GET_UINT32(buf); - gid_len = (size_t)IXDR_GET_UINT32(buf); - if (gid_len > NGRPS) { + supp_ngroups = (size_t)IXDR_GET_UINT32(buf); + if (supp_ngroups > NGRPS) { stat = AUTH_BADCRED; goto done; } - for (i = 0; i < gid_len; i++) { + for (i = 0; i < supp_ngroups; i++) { + /* + * Note that this is a `struct xucred`, which maintains + * its historical layout of preserving the egid in + * cr_ngroups and cr_groups[0] == egid. + */ if (i + 1 < XU_NGROUPS) xcr->cr_groups[i + 1] = IXDR_GET_INT32(buf); else buf++; } - if (gid_len + 1 > XU_NGROUPS) + if (supp_ngroups + 1 > XU_NGROUPS) xcr->cr_ngroups = XU_NGROUPS; else - xcr->cr_ngroups = gid_len + 1; + xcr->cr_ngroups = supp_ngroups + 1; /* * five is the smallest unix credentials structure - * timestamp, hostname len (0), uid, gid, and gids len (0). */ - if ((5 + gid_len) * BYTES_PER_XDR_UNIT + str_len > auth_len) { + if ((5 + supp_ngroups) * BYTES_PER_XDR_UNIT + str_len > auth_len) { (void) printf("bad auth_len gid %ld str %ld auth %u\n", - (long)gid_len, (long)str_len, auth_len); + (long)supp_ngroups, (long)str_len, auth_len); stat = AUTH_BADCRED; goto done; }