git: 330b91854917 - releng/15.0 - sys/rpc: UNIX auth: Rename 'ngroups' => 'supp_ngroups' for clarity

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Thu, 16 Oct 2025 18:50:18 UTC
The branch releng/15.0 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=330b91854917ce416700ecb8a2a1d781f9abe45f

commit 330b91854917ce416700ecb8a2a1d781f9abe45f
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-10-07 10:03:07 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-16 18:47:57 +0000

    sys/rpc: UNIX auth: Rename 'ngroups' => 'supp_ngroups' for clarity
    
    Approved by:    re (cperciva)
    MFC after:      2 days
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit bda3b61512b2597d4c77d2b9c9074b844dec0405)
    (cherry picked from commit 5e482104ecfa57b6debc3c495f2dcb2d2ea50ea2)
---
 sys/rpc/authunix_prot.c | 16 ++++++++--------
 sys/rpc/svc_auth_unix.c | 16 ++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/sys/rpc/authunix_prot.c b/sys/rpc/authunix_prot.c
index b107d5541c50..f63a6d3f9dc6 100644
--- a/sys/rpc/authunix_prot.c
+++ b/sys/rpc/authunix_prot.c
@@ -60,7 +60,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];
 
@@ -102,14 +102,14 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred)
 		 * historical layout of preserving the egid in cr_ngroups and
 		 * cr_groups[0] == egid.
 		 */
-		ngroups = cred->cr_ngroups - 1;
-		if (ngroups > NGRPS)
-			ngroups = NGRPS;
+		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);
@@ -120,10 +120,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 963f4f272964..aad4e7610795 100644
--- a/sys/rpc/svc_auth_unix.c
+++ b/sys/rpc/svc_auth_unix.c
@@ -65,7 +65,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;
@@ -84,12 +84,12 @@ _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
@@ -100,18 +100,18 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
 			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;
 		}