mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
groupmember(), realgroupmember(): Return a bool instead of an int
Requested by: mhorne Reviewed by: mhorne MFC after: 2 weeks MFC to: stable/14 releng/14.0 Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40958
This commit is contained in:
parent
0452dd8413
commit
ffd3ef8ee0
2 changed files with 8 additions and 8 deletions
|
|
@ -1279,7 +1279,7 @@ sys___setugid(struct thread *td, struct __setugid_args *uap)
|
|||
/*
|
||||
* Returns whether gid designates a supplementary group in cred.
|
||||
*/
|
||||
static int
|
||||
static bool
|
||||
supplementary_group_member(gid_t gid, struct ucred *cred)
|
||||
{
|
||||
int l, h, m;
|
||||
|
|
@ -1306,12 +1306,12 @@ supplementary_group_member(gid_t gid, struct ucred *cred)
|
|||
* Check if gid is a member of the (effective) group set (i.e., effective and
|
||||
* supplementary groups).
|
||||
*/
|
||||
int
|
||||
bool
|
||||
groupmember(gid_t gid, struct ucred *cred)
|
||||
{
|
||||
|
||||
if (cred->cr_groups[0] == gid)
|
||||
return (1);
|
||||
if (gid == cred->cr_groups[0])
|
||||
return (true);
|
||||
|
||||
return (supplementary_group_member(gid, cred));
|
||||
}
|
||||
|
|
@ -1320,11 +1320,11 @@ groupmember(gid_t gid, struct ucred *cred)
|
|||
* Check if gid is a member of the real group set (i.e., real and supplementary
|
||||
* groups).
|
||||
*/
|
||||
int
|
||||
bool
|
||||
realgroupmember(gid_t gid, struct ucred *cred)
|
||||
{
|
||||
if (gid == cred->cr_rgid)
|
||||
return (1);
|
||||
return (true);
|
||||
|
||||
return (supplementary_group_member(gid, cred));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,8 +158,8 @@ void crcowfree(struct thread *td);
|
|||
void cru2x(struct ucred *cr, struct xucred *xcr);
|
||||
void cru2xt(struct thread *td, struct xucred *xcr);
|
||||
void crsetgroups(struct ucred *cr, int n, gid_t *groups);
|
||||
int groupmember(gid_t gid, struct ucred *cred);
|
||||
int realgroupmember(gid_t gid, struct ucred *cred);
|
||||
bool groupmember(gid_t gid, struct ucred *cred);
|
||||
bool realgroupmember(gid_t gid, struct ucred *cred);
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_SYS_UCRED_H_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue