cred: Update some comments after 'cr_gid' is no more cr_groups[0]
While here, fix style of some already-updated comments.
Fixes: be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after: 5 days
MFC to: stable/15
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52266
This commit is contained in:
+6
-12
@@ -1803,12 +1803,6 @@ groupmember(gid_t gid, const struct ucred *cred)
|
||||
bool
|
||||
realgroupmember(gid_t gid, const struct ucred *cred)
|
||||
{
|
||||
/*
|
||||
* Although the equality test on 'cr_rgid' below doesn't access
|
||||
* 'cr_groups', we check for the latter's length here as we assume that,
|
||||
* if 'cr_ngroups' is 0, the passed 'struct ucred' is invalid, and
|
||||
* 'cr_rgid' may not have been filled.
|
||||
*/
|
||||
groups_check_positive_len(cred->cr_ngroups);
|
||||
|
||||
if (gid == cred->cr_rgid)
|
||||
@@ -2921,8 +2915,8 @@ crextend(struct ucred *cr, int n)
|
||||
* Normalizes a set of groups to be applied to a 'struct ucred'.
|
||||
*
|
||||
* Normalization ensures that the supplementary groups are sorted in ascending
|
||||
* order and do not contain duplicates. This allows group_is_supplementary
|
||||
* to do a binary search.
|
||||
* order and do not contain duplicates. This allows group_is_supplementary() to
|
||||
* do a binary search.
|
||||
*/
|
||||
static void
|
||||
groups_normalize(int *ngrp, gid_t *groups)
|
||||
@@ -2985,9 +2979,9 @@ crsetgroups_internal(struct ucred *cr, int ngrp, const gid_t *groups)
|
||||
* Copy groups in to a credential after expanding it if required.
|
||||
*
|
||||
* May sleep in order to allocate memory (except if, e.g., crextend() was called
|
||||
* before with 'ngrp' or greater). Truncates the list to ngroups_max if
|
||||
* before with 'ngrp' or greater). Truncates the list to 'ngroups_max' if
|
||||
* it is too large. Array 'groups' doesn't need to be sorted. 'ngrp' must be
|
||||
* strictly positive.
|
||||
* positive.
|
||||
*/
|
||||
void
|
||||
crsetgroups(struct ucred *cr, int ngrp, const gid_t *groups)
|
||||
@@ -3018,8 +3012,8 @@ crsetgroups(struct ucred *cr, int ngrp, const gid_t *groups)
|
||||
* Same as crsetgroups() but sets the effective GID as well.
|
||||
*
|
||||
* This function ensures that an effective GID is always present in credentials.
|
||||
* An empty array will only set the effective GID to the default_egid, while a
|
||||
* non-empty array will peel off groups[0] to set as the effective GID and use
|
||||
* An empty array will only set the effective GID to 'default_egid', while
|
||||
* a non-empty array will peel off groups[0] to set as the effective GID and use
|
||||
* the remainder, if any, as supplementary groups.
|
||||
*/
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user