Skip to content

Commit bda3b61

Browse files
committed
sys/rpc: UNIX auth: Rename 'ngroups' => 'supp_ngroups' for clarity
MFC after: 2 days Sponsored by: The FreeBSD Foundation
1 parent af30e8d commit bda3b61

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

sys/rpc/authunix_prot.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bool_t
6060
xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred)
6161
{
6262
uint32_t namelen;
63-
uint32_t ngroups, i;
63+
uint32_t supp_ngroups, i;
6464
uint32_t junk;
6565
char hostbuf[MAXHOSTNAMELEN];
6666

@@ -102,14 +102,14 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred)
102102
* historical layout of preserving the egid in cr_ngroups and
103103
* cr_groups[0] == egid.
104104
*/
105-
ngroups = cred->cr_ngroups - 1;
106-
if (ngroups > NGRPS)
107-
ngroups = NGRPS;
105+
supp_ngroups = cred->cr_ngroups - 1;
106+
if (supp_ngroups > NGRPS)
107+
supp_ngroups = NGRPS;
108108
}
109109

110-
if (!xdr_uint32_t(xdrs, &ngroups))
110+
if (!xdr_uint32_t(xdrs, &supp_ngroups))
111111
return (FALSE);
112-
for (i = 0; i < ngroups; i++) {
112+
for (i = 0; i < supp_ngroups; i++) {
113113
if (i < ngroups_max) {
114114
if (!xdr_uint32_t(xdrs, &cred->cr_groups[i + 1]))
115115
return (FALSE);
@@ -120,10 +120,10 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred)
120120
}
121121

122122
if (xdrs->x_op == XDR_DECODE) {
123-
if (ngroups > ngroups_max)
123+
if (supp_ngroups > ngroups_max)
124124
cred->cr_ngroups = ngroups_max + 1;
125125
else
126-
cred->cr_ngroups = ngroups + 1;
126+
cred->cr_ngroups = supp_ngroups + 1;
127127
}
128128

129129
return (TRUE);

sys/rpc/svc_auth_unix.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
6565
uint32_t time;
6666
struct xucred *xcr;
6767
u_int auth_len;
68-
size_t str_len, gid_len;
68+
size_t str_len, supp_ngroups;
6969
u_int i;
7070

7171
xcr = rqst->rq_clntcred;
@@ -84,12 +84,12 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
8484
buf += str_len / sizeof (int32_t);
8585
xcr->cr_uid = IXDR_GET_UINT32(buf);
8686
xcr->cr_gid = IXDR_GET_UINT32(buf);
87-
gid_len = (size_t)IXDR_GET_UINT32(buf);
88-
if (gid_len > NGRPS) {
87+
supp_ngroups = (size_t)IXDR_GET_UINT32(buf);
88+
if (supp_ngroups > NGRPS) {
8989
stat = AUTH_BADCRED;
9090
goto done;
9191
}
92-
for (i = 0; i < gid_len; i++) {
92+
for (i = 0; i < supp_ngroups; i++) {
9393
/*
9494
* Note that this is a `struct xucred`, which maintains
9595
* its historical layout of preserving the egid in
@@ -100,18 +100,18 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
100100
else
101101
buf++;
102102
}
103-
if (gid_len + 1 > XU_NGROUPS)
103+
if (supp_ngroups + 1 > XU_NGROUPS)
104104
xcr->cr_ngroups = XU_NGROUPS;
105105
else
106-
xcr->cr_ngroups = gid_len + 1;
106+
xcr->cr_ngroups = supp_ngroups + 1;
107107

108108
/*
109109
* five is the smallest unix credentials structure -
110110
* timestamp, hostname len (0), uid, gid, and gids len (0).
111111
*/
112-
if ((5 + gid_len) * BYTES_PER_XDR_UNIT + str_len > auth_len) {
112+
if ((5 + supp_ngroups) * BYTES_PER_XDR_UNIT + str_len > auth_len) {
113113
(void) printf("bad auth_len gid %ld str %ld auth %u\n",
114-
(long)gid_len, (long)str_len, auth_len);
114+
(long)supp_ngroups, (long)str_len, auth_len);
115115
stat = AUTH_BADCRED;
116116
goto done;
117117
}

0 commit comments

Comments
 (0)